Guest User

Untitled

a guest
Oct 17th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. def linear_regression():
  2. x = tf.placeholder(tf.float32, shape=(None, ), name='x')
  3. y = tf.placeholder(tf.float32, shape=(None, ), name='y')
  4.  
  5. with tf.variable_scope('lreg') as scope:
  6. w = tf.Variable(np.random.normal(), name='W')
  7.  
  8. y_pred = tf.multiply(w, x)
  9.  
  10. loss = tf.reduce_mean(tf.square(y_pred - y))
  11.  
  12. return x, y, y_pred, loss
Add Comment
Please, Sign In to add comment