In [1]:
import tensorflow as tf
In [2]:
sess = tf.Session()
In [8]:
# tf.div return same type with input type
# integer type
print(sess.run(tf.div(3, 4)))
print()
# float type returns
print(sess.run(tf.div(3., 4)))
print()
# this division will occurs an error
# print(sess.run(tf.div(3, 4.)))
# print()
# float type returns
print(sess.run(tf.div(3., 4.)))
In [9]:
# if you expect as python3 division in tensorflow, you should use tf.truediv()
print(sess.run(tf.truediv(3, 4)))
In [10]:
print(sess.run(tf.floordiv(3.0, 4.0)))
In [11]:
# remainder
print(sess.run(tf.mod(22.0, 5.0)))
In [12]:
# Cross production
print(sess.run(tf.cross([1., 0., 0.], [0., 1., 0.])))
In [ ]:
#