Skip to content

Instantly share code, notes, and snippets.

@hackintoshrao
Created May 7, 2018 03:40
Show Gist options
  • Save hackintoshrao/efe49ae78eff1cd41de5875926decd0a to your computer and use it in GitHub Desktop.
Save hackintoshrao/efe49ae78eff1cd41de5875926decd0a to your computer and use it in GitHub Desktop.
Basics of tensorflow
import tensorflow as tf
# You can create constants in TF to hold specific values
a = tf.constant(1)
b = tf.constant(2)
A = tf.constant(1234)
# B is a 1-dimensional int32 tensor
B = tf.constant([123,456,789])
# C is a 2-dimensional int32 tensor
C = tf.constant([ [123,456,789], [222,333,444] ])
# Adding and multiplying the constants
c = a + b
d = a * b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment