我從例子中善於學習TensorFlow:https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/2_BasicModels/linear_regression.ipynbTensorFlow:tf.placeholder和tf.Variable - 爲什麼不需要該維度?
我在下面的代碼中的幾個問題: 當定義佔位符和變量,如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)
謝謝!可變情況如何? – Edamame
剛纔看到你也在問這個......我更新了答案來解釋。 – mrry
當我讀取代碼在https://github.com/aymericdamien/TensorFlow-Examples/blob/master/notebooks/2_BasicModels/linear_regression.ipynb在我看來,變量W是一個數組,而不是標量。我理解錯了嗎?謝謝! – Edamame