版权声明:博主原创文章属私人所有,未经允许 不可转发和使用 https://blog.csdn.net/a1066196847/article/details/85122236
完整报错:
TypeError: Value passed to parameter 'labels' has DataType float32 not in list of allowed values: int32, int64
解释:labels在内存里真实的是int型,但是定义的却是float32型
错误代码可能是这样:
Y = tf.cond(is_training, lambda:tf.placeholder(dtype=tf.float32, shape=([50])), lambda:tf.placeholder(dtype=tf.float32, shape=([60]))
改正后:
Y = tf.cond(is_training, lambda:tf.placeholder(dtype=tf.int32, shape=([50])), lambda:tf.placeholder(dtype=tf.int32, shape=([60]))