Tensorflow Getting Started Notebook


In [2]:
import tensorflow as tf
import numpy as np

In [3]:
print("tensorflow version: " + tf.__version__)
print("numpy version: " + np.__version__)


tensorflow version: 1.3.0
numpy version: 1.13.3

In [4]:
x = np.array([[1, 2],[3, 4]])
print(x)


[[1 2]
 [3 4]]

In [5]:
y = np.array([[5, 6],[7, 8]])
print(y)


[[5 6]
 [7 8]]

In [6]:
with tf.Session() as sess:
    
    tf_x = tf.Variable(x)
    tf_y = tf.Variable(y)
    
    tf_init = tf.variables_initializer([tf_x, tf_y])
    sess.run(tf_init)
    
    tf_add = tf.add(tf_x, tf_y)
    np_add = sess.run(tf_add)
    
    print(np_add)


[[ 6  8]
 [10 12]]