1. 程式人生 > >ValueError: Shape must be rank 2 but is rank 0 for 'MatMul_8' (op: 'MatMul') with input shapes: [],

ValueError: Shape must be rank 2 but is rank 0 for 'MatMul_8' (op: 'MatMul') with input shapes: [],

這個報錯多半是因為自己在定義placeholder的時候,沒有指定shape,導致系統預設將X看做為標量,無法做出正確的匹配

X = tf.placeholder(dtype=tf.float32, shape=()  -》 X = tf.placeholder(dtype=tf.float32, shape=([50,93]))