Paddle 多维输入CrossEntropyLoss报错

qyuhtwio  于 2021-11-29  发布在  Java
关注(0)|答案(2)|浏览(507)
  • 标题:多维输入CrossEntropyLoss报错
  • 版本、环境信息:

Paddle version: 2.1.2
Paddle With CUDA: True

OS: Deepin 20.2
Python version: 3.7.3

CUDA version: 9.2.148
cuDNN version: None.None.None
Nvidia driver version: 460.39

[Hint: Expected logits_dims[i] == labels_dims[i], but received logits_dims[i]:2 != labels_dims[i]:100.] (at /paddle/paddle/fluid/operators/softmax_with_cross_entropy_op.cc:150)
[operator < softmax_with_cross_entropy > error]

  • 问题描述:应该是要求logits和label所有对应周必须相等,也就是input的C要等于label的d1;但用paddle.nn.LogSoftmax(axis=1)+paddle.nn.loss.NLLLoss()没这个错误
6gpjuf90

6gpjuf901#

您好,我们已经收到了您的问题,会安排技术人员尽快解答您的问题,请耐心等待。请您再次检查是否提供了清晰的问题描述、复现代码、环境&版本、报错信息等。同时,您也可以通过查看官网API文档常见问题历史IssueAI社区来寻求解答。祝您生活愉快~

Hi! We've received your issue and please be patient to get responded. We will arrange technicians to answer your questions as soon as possible. Please make sure that you have posted enough message to demo your request. You may also check out the APIFAQGithub Issue and AI community to get the answer.Have a nice day!

fsi0uk1n

fsi0uk1n2#

你好目前CrossEntropyLoss的文档说明确实存在问题,最近已经在develop分支中对其进行了修复

input的形状中通道需要放在最后,将input的形状变为[5,100,2]应该能正常运行了

相关问题