Skip to content

Instantly share code, notes, and snippets.

@SuvroBaner
Created December 31, 2019 08:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SuvroBaner/9f89d2ae31a5328e23daed2ea90fb282 to your computer and use it in GitHub Desktop.
Save SuvroBaner/9f89d2ae31a5328e23daed2ea90fb282 to your computer and use it in GitHub Desktop.
def linear_function():
X = np.random.randn(4, 1) # Initializes X to be a random tensor of shape (4,1)
W = np.random.randn(5, 4) # Initializes W to be a random tensor of shape (5,4)
b = np.random.randn(5, 1) # Initializes b to be a random tensor of shape (5,1)
Y = tf.add(tf.matmul(W, X), b) # computation graph
sess = tf.Session()
result = sess.run(Y) # evaluating the computation graph
sess.close() # closing the tf session
return result
print(linear_function())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment