TensorFlow用softmax_cross_entropy_with_logits的loss一直增大

因为softmax_cross_entropy_with_logits传入的labels要是one-hot的,
labelslogits的shape相同

转化方法:

labels_onehot = tf.one_hot(input_y, num_classes)

input_y是[batch_size]的shape

发布了1142 篇原创文章 · 获赞 196 · 访问量 260万+

猜你喜欢

转载自blog.csdn.net/guotong1988/article/details/103299433