Simple Multiplier


In [1]:
# Import tensorflow
import tensorflow as tf

In [2]:
def multiply(num, num2):
    # Create symbolic variables
    ft_num = tf.placeholder("int8")
    ft_num2 = tf.placeholder("int8")

    # Apply multiply function
    simpleMultiplier = tf.multiply(ft_num, ft_num2)
    
    # Create session
    sess = tf.Session()

    # Excute equation
    result = sess.run(simpleMultiplier, {ft_num: num, ft_num2: num2})
    
    return result

In [3]:
print("Result 3*5 from native python: {}".format(3*5))
print("Result 3*5 from tensorFlow: {}".format(multiply(3, 5)))


Result 3*5 from native python: 15
Result 3*5 from tensorFlow: 15