【发布时间】:2016-12-27 22:03:36
【问题描述】:
我正在通过以下示例学习 TensorFlow:https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/2_BasicModels/linear_regression.ipynb
我在下面的代码中有几个问题: 在定义 X、Y、W 和 b 等占位符和变量时,为什么我们不需要指定它们的维度?如果不知道这些占位符/变量的大小,代码将如何分配内存?谢谢!
# tf Graph Input
X = tf.placeholder("float")
Y = tf.placeholder("float")
# Set model weights
W = tf.Variable(rng.randn(), name="weight")
b = tf.Variable(rng.randn(), name="bias")
# Construct a linear model
pred = tf.add(tf.mul(X, W), b)
【问题讨论】:
标签: python-3.x tensorflow