最近在学习tensorflow,从官方例子cifar10学起,将全部代码迁移至自身项目后,发现报如下错误:
ValueError: All shapes must be fully defined: [TensorShape([Dimension(24), Dimension(24), Dimension(3)]), TensorShape([Dimension(None)])]
属于tensorflow官方bug,经亲测,发现解决方案如下:
将cifar10_input.py文件代码:
result.label = tf.cast(
tf.strided_slice(record_bytes, [0], [label_bytes],[1]), tf.int32)
改为:
result.label = tf.reshape(tf.cast(
tf.strided_slice(record_bytes, [0], [label_bytes],[1]), tf.int32),[1,1])
即可。