Skip to content

Commit c148ac5

Browse files
authored
Update linear_regression.py
changing variable initialization way as per tensorflow standards.thanks if any thing wrong i am going please let me know. i m beginner in tensorflow.
1 parent 796de7c commit c148ac5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

examples/2_BasicModels/linear_regression.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
X = tf.placeholder("float")
2929
Y = tf.placeholder("float")
3030

31-
# Set model weights
32-
W = tf.Variable(rng.randn(), name="weight")
33-
b = tf.Variable(rng.randn(), name="bias")
31+
# Set model weights and bias as variable (get_variable uses is recommended by tensorflow)
32+
W = tf.get_variable(initializer=rng.randn(), name="weight")
33+
b = tf.get_variable(initializer= rng.randn(), name="bias")
3434

3535
# Construct a linear model
3636
pred = tf.add(tf.multiply(X, W), b)

0 commit comments

Comments
 (0)