Skip to content

Instantly share code, notes, and snippets.

@BinRoot
Created November 8, 2016 05:48
Show Gist options
  • Save BinRoot/5e30cb2c26ed6a50d5a8ed78d7890cda to your computer and use it in GitHub Desktop.
Save BinRoot/5e30cb2c26ed6a50d5a8ed78d7890cda to your computer and use it in GitHub Desktop.
import tensorflow as tf
# Define a matrix and negate it
matrix = tf.constant([[1., 2.]])
negMatrix = tf.neg(matrix)
# Start the session with a special config passed into the constructor to enable logging
with tf.Session(config=tf.ConfigProto(log_device_placement=True)) as sess:
# Evaluate negMatrix
result = sess.run(negMatrix)
# Print the resulting value
print(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment