Graph execution error: Detected at node ‘sparse_categorical_crossentropy/SparseSoftmaxCrossEntropyW

  • Post author:
  • Post category:其他


错误:Graph execution error: Detected at node ‘sparse_categorical_crossentropy/SparseSoftmaxCrossEntropyWithLogits/SparseSoftmaxCrossEntropyWithLogits’ defined at (most recent call last):

实际上是损失函数的问题、

model.compile(optimizer= opt, loss= 'sparse_categorical_crossentropy', metrics=['accuracy']) # adam优化器,loss function,训练过程中计算准确率

解决错误方法:将loss= ‘sparse_categorical_crossentropy’改为

‘categorical_crossentropy’

model.compile(optimizer= opt, loss= 'categorical_crossentropy', metrics=['accuracy'])



版权声明:本文为qq_41542894原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。