当前位置:网站首页>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]
边栏推荐
猜你喜欢

UE4.24版本VR项目打包后,未出现手柄控制器

VMware uses wireless network card NAT to access the Internet under Windows

NT68661-屏参升级-RK3128-开机自己升级屏参

Customized development of ant chain NFT digital collection DAPP mall system

Data warehouse 4.0 notes - user behavior data collection IV

MySQL storage engine

Using cluster analysis to build a credit card high-risk customer identification model

Data warehouse 4.0 notes - user behavior data collection III

数仓4.0笔记——用户行为数据采集四

8、 Collection framework and generics
随机推荐
数仓4.0笔记——业务数据采集——Sqoop
ChaosLibrary·UE4开坑笔记
[metric] use Prometheus to monitor flink1.13org.apache.flink.metrics
NFT digital collection system development: the combination of music and NFT
查看真机APP里面沙盒文件
Develop necessary idea use
[flick]flick on yarn's flick conf simplest configuration
數倉4.0筆記——業務數據采集
Adding environment variables and templates to systemctl service
链队列
ninja介绍及使用
Development of digital collection system: enterprise layout meta universe digital collection
MySQL user management
MySQL数据库
Shell takes the month within a certain time range
SQL realizes the user statistics of continuous login for more than 7 days
2. MySQL data management - DML (add, modify, delete data)
[pyrodiomics] the extracted image omics characteristic value is abnormal (many 0 and 1)
Machine learning algorithm for large factory interview (5) recommendation system algorithm
Websocket long connection