遇上如题所示问题,多半是因为使用了sparse_categorical_crossentropy作为损失函数
这会出现在分类问题中,这个激活函数要求如下:

labels vector must provide a single specific index for the true class for each row of logits

也就是说,你给的真实输出值,得是一个索引index而不是one hot编码,比如你给定的真实输出值应该是0而非[1, 0, 0, 0, 0]

参考文献:

相关文章:

  • 2021-11-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-06
  • 2022-12-23
  • 2022-12-23
  • 2022-02-06
猜你喜欢
  • 2022-01-16
  • 2021-05-11
  • 2021-08-09
  • 2022-01-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案