在做多元线性回归的时候多余模型:y = tf.matmul(x_data,w) +b 中:
我的x_data 使用tf.placeholder(tf.float32,[1,2]) 申明的;
而我的输入的是整数
解决办法:
1:直接把输入输成浮点型的,如:输入3,你可以直接输入3.00
2:加上类型转换,可以用numpy申明数组的时候通过astype(numpy.float32) 即:data = np.array([1,2]).astype(numpy.float32)
TypeError: Input 'b' of 'MatMul' Op has type int64 that does not match type float32 of argument 'a'.
原文:https://www.cnblogs.com/bluesl/p/9215758.html