当前位置:网站首页>paddle.nn.BCELoss的使用问题
paddle.nn.BCELoss的使用问题
2022-07-23 05:42:00 【KHB1698】
ValueError: (InvalidArgument) Cannot get attribute (value) by type float, its type is std::__cxx11::basic_string<char, std::char_traits, std::allocator >. (at /paddle/paddle/fluid/framework/attribute.h:164)
代码:
import paddle
input = paddle.to_tensor( [[0.49922279],[0.46373418]], dtype='float32')
label = paddle.to_tensor([[0.],[1.]], dtype='float32')
output = paddle.nn.BCELoss(input, label)
print(output)
报错:ValueError: (InvalidArgument) Cannot get attribute (value) by type float, its type is std::__cxx11::basic_string<char, std::char_traits, std::allocator >. (at /paddle/paddle/fluid/framework/attribute.h:164)
解决办法:
import paddle
input = paddle.to_tensor( [[0.49922279],[0.46373418]], dtype='float32')
label = paddle.to_tensor([[0.],[1.]], dtype='float32')
bce_loss = paddle.nn.BCELoss()
output = bce_loss(input, label)
print(output) # [0.65537095]
边栏推荐
猜你喜欢

MySQL index

Data warehouse 4.0 notes - Data Warehouse Modeling

11. Multithreading
![[literature research] search PubMed for papers in journals with specific impact factors](/img/5e/ea762830e73eee2700402d70ba5c43.png)
[literature research] search PubMed for papers in journals with specific impact factors

NFT digital collection development: Jingdong "Qida bear takes you to the capital" tourism package

Data warehouse 4.0 notes - user behavior data collection I

Activiti7 Quick Start experience sharing

2. MySQL data management - DML (add, modify, delete data)

10、I/O 输入输出流

數倉4.0筆記——用戶行為數據采集四
随机推荐
NFT digital collection system development: Shenzhen Evening News "good times travel" digital collection online seconds chime
MySQL存储引擎
Image fuzzy processing batch production fuzzy data set
9、 Practical class
Development of digital collection system: what are the main features of NFT?
链队列
[untitled]
10. I/o input / output stream
ChaosLibrary·UE4开坑笔记
数仓4.0笔记——业务数据采集——Sqoop
UItextview的textViewDidChange的使用技巧
Develop necessary idea use
[flick]flick on yarn's flick conf simplest configuration
MySQL password free login settings
MySQL数据库
Mysqldump batch export MySQL table creation statement
數倉4.0筆記——業務數據采集
MySQL transaction
MySQL modify function permission is not effective
NFT trading platform digital collection system | development and customization