最近在學習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])
即可。