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

In [4]:
input_shape = [3, 5]
input_x = tf.constant(1.0, shape=input_shape)
input_x.shape


Out[4]:
TensorShape([Dimension(3), Dimension(5)])

In [5]:
sess = tf.InteractiveSession()
input_x.eval()


Out[5]:
array([[ 1.,  1.,  1.,  1.,  1.],
       [ 1.,  1.,  1.,  1.,  1.],
       [ 1.,  1.,  1.,  1.,  1.]], dtype=float32)

In [13]:
y = tf.constant([1., 2., 3., 4., 5.,])
addition = input_x + y
addition.eval()


Out[13]:
array([[ 2.,  3.,  4.,  5.,  6.],
       [ 2.,  3.,  4.,  5.,  6.],
       [ 2.,  3.,  4.,  5.,  6.]], dtype=float32)

In [12]:
y = tf.constant([1., 2., 3., 4., 5.,])
product = input_x * y
product.eval()


Out[12]:
array([[ 1.,  2.,  3.,  4.,  5.],
       [ 1.,  2.,  3.,  4.,  5.],
       [ 1.,  2.,  3.,  4.,  5.]], dtype=float32)

In [14]:
sess.close()

In [ ]: