Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tensorflow as tf
- print("Pythonic:")
- print(8 + 5)
- print(8 - 5)
- print(8 * 5)
- print(8 / 5)
- print(8**5)
- print(8 % 5)
- print(8 // 5)
- x = tf.constant(8)
- y = tf.constant(5)
- tf_add = tf.add(x, y)
- tf_subtract = tf.subtract(x, y)
- tf_multiply = tf.multiply(x, y)
- tf_divide = tf.divide(x, y)
- tf_pow = tf.pow(x, y)
- tf_mod = tf.mod(x, y)
- tf_quotient = tf.div(x, y)
- print("TensorFlow:")
- with tf.Session() as sess:
- print(sess.run(tf_add))
- print(sess.run(tf_subtract))
- print(sess.run(tf_multiply))
- print(sess.run(tf_divide))
- print(sess.run(tf_pow))
- print(sess.run(tf_mod))
- print(sess.run(tf_quotient))
Add Comment
Please, Sign In to add comment