In [2]:
import tensorflow as tf
import numpy as np
In [3]:
print("tensorflow version: " + tf.__version__)
print("numpy version: " + np.__version__)
In [4]:
x = np.array([[1, 2],[3, 4]])
print(x)
In [5]:
y = np.array([[5, 6],[7, 8]])
print(y)
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)