执行如下语句报错 TypeError: Input ‘b’ of ‘MatMul’ Op has type float32 that does not match type int32 of argument ‘a’.
X_in = tf.matmul(X,weights[‘in’])+biases[‘in’]
在使用tf.matmul()时提示两个参量一个为float32型,另外一个为float32型
解决方法:转换成同类型。
矩阵乘前进行X类型转换X=tf.cast(X,tf.float32)
变为
X=tf.cast(X,tf.float32)
X_in = tf.matmul(X,weights[‘in’])+biases[‘in’]