我正在尝试学习tensorflow,我已经用简单的感知器做了一些练习,比如,一个特征,一个输出。
我现在正在尝试更多的功能,但是,我的变量/占位符形状有问题。我以为我学会了它是如何工作的,但看起来我错了。我想知道如何获得好的值,这样我就不会再遇到这种问题了。
下面是我的代码:
在……里面
print(inputX.shape)
print(inputY.shape)输出
(50,9) (50,1)
在……里面
x = tf.placeholder(tf.float32,[None, 9]) #features
y = tf.placeholder(tf.float32, [None, 1]) #labels
W = tf.Variable(tf.random_normal([1, 9])) #Weights, nb of labels[x,x]nb of features
b = tf.Variable(tf.zeros([1])) #[x]nb of features
Y = tf.nn.relu(tf.add(tf.matmul(x, W),b)) 输出
尺寸必须相等,但对于输入形状为?、9、1、9的'MatMul_21‘(op:'MatMul'),尺寸必须为9和1。
我猜问题是1,但我不知道它来自哪里。
感谢您的帮助!
https://stackoverflow.com/questions/44432600
复制相似问题