In [2]:
import tensorflow as tf
In [3]:
a = tf.constant(2)
b = tf.constant(3)
In [4]:
with tf.Session() as sess:
print(sess.run(a+b))
print(sess.run(a*b))
In [5]:
a = tf.placeholder(tf.int16)
b = tf.placeholder(tf.int16)
In [6]:
add = tf.add(a,b)
mul = tf.mul(a,b)
In [9]:
with tf.Session() as sess:
print(sess.run(add, feed_dict={a:2, b:3})) # it shouldn't be string key
In [12]:
matrix1 = tf.constant([[3., 3.]])
matrix2 = tf.constant([[2.],[2.]])
In [13]:
product = tf.matmul(matrix1, matrix2)
In [15]:
with tf.Session() as sess:
result = sess.run(product)
print(result)