In [1]:
    
import tensorflow as tf
    
In [2]:
    
a = tf.constant(1.5)
b = tf.constant(2, dtype=tf.float32)
    
In [3]:
    
a
    
    Out[3]:
In [4]:
    
b
    
    Out[4]:
In [5]:
    
c = a + b
    
In [6]:
    
c
    
    Out[6]:
In [8]:
    
with tf.Session() as session:
    res = session.run(c)
    res2 = a.eval()
    print(res)
    print(res2)
    
    
In [9]:
    
state = tf.Variable(0)
one = tf.constant(1)
update = tf.assign(state, state + one)
    
In [10]:
    
with tf.Session() as session:
    # It is mandatory to initialize variables before we start running the graph
    session.run(tf.global_variables_initializer())
    print(session.run(state))
    for ind in range(5):
        session.run(update)
        print(session.run(state))
    
    
In [11]:
    
input_data = tf.placeholder(tf.float32)
    
In [12]:
    
op = tf.matmul(input_data, tf.transpose(input_data))
    
In [13]:
    
with tf.Session() as session:
    res = session.run(op, feed_dict={input_data: [[0, 1, 2, 3]]})
    print(res)
    
    
In [ ]: