【发布时间】:2016-05-04 23:19:27
【问题描述】:
我的输入数据一步 numpy 数组长度为 36 个浮点数
[-0.712982 1.14461327 -0.46141151 -0.39443004 -0.44848472 -0.65676075
0.56058383 -0.61031222 0.43211082 -0.74852234 1.28183317 0.79719085
-0.28156522 0.16901374 -0.73715878 0.69877005 -0.40633941 0.01085454
-0.33675554 -0.37056464 -0.43088505 0.3327457 -0.15905562 0.72995877
0.56962079 0.10286932 0.25698286 0.89823145 -0.12923111 0.3219386
0.10118762 1.29127014 -0.22283298 0.75640506 0.79971719 0.60000002]
我的部分代码:
X = tf.placeholder(tf.float32, (36))
Y = tf.placeholder(tf.float32)
# Create Model
# Set model weights
W = tf.Variable(tf.zeros([36], name="weight"))
b = tf.Variable(tf.zeros([1]), name="bias")
# Construct model
activation = tf.add(tf.matmul(X, W), b)
在这种情况下 tf.matmul 不起作用(ValueError:Shape (36,) 必须具有等级 2)。 我需要进行哪些更改才能将激活作为单个浮点数?
【问题讨论】:
标签: python tensorflow