Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def linear_regression():
- x = tf.placeholder(tf.float32, shape=(None, ), name='x')
- y = tf.placeholder(tf.float32, shape=(None, ), name='y')
- with tf.variable_scope('lreg') as scope:
- w = tf.Variable(np.random.normal(), name='W')
- y_pred = tf.multiply(w, x)
- loss = tf.reduce_mean(tf.square(y_pred - y))
- return x, y, y_pred, loss
Add Comment
Please, Sign In to add comment