Skip to content

Commit c0a784a

Browse files
ddurham2aymericdamien
authored andcommitted
For the sake of the TF beginner (this is Example aymericdamien#2 afterall), added a helpful comment about how the optimizer knows to modify W and b
1 parent 373d981 commit c0a784a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

examples/2_BasicModels/linear_regression.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
# Mean squared error
3939
cost = tf.reduce_sum(tf.pow(pred-Y, 2))/(2*n_samples)
4040
# Gradient descent
41+
# Note, minimize() knows to modify W and b because Variable objects are trainable=True by default
4142
optimizer = tf.train.GradientDescentOptimizer(learning_rate).minimize(cost)
4243

4344
# Initializing the variables

0 commit comments

Comments
 (0)