Skip to content

Instantly share code, notes, and snippets.

@BinRoot
Created November 8, 2016 05:46
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 BinRoot/b6038cfb9018246546a7091215d0fcb1 to your computer and use it in GitHub Desktop.
Save BinRoot/b6038cfb9018246546a7091215d0fcb1 to your computer and use it in GitHub Desktop.
import tensorflow as tf
# Define an arbitrary matrix
matrix = tf.constant([[1., 2.]])
# Run the negation operator on it
neg_matrix = tf.neg(matrix)
# Start a session to be able to run operations
with tf.Session() as sess:
# Tell the session to evaluate negMatrix
result = sess.run(neg_matrix)
# Print the resulting matrix
print(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment