Creating Tensors: Setting DataTypes
In [1]:
import tensorflow as tfIn [2]:
floatArr = [1.7, 7.4]
tensorFloat = tf.constant(floatArr)
tensorFloat.dtypeOut [2]:
In [4]:
#
# using tf.cast
#
castedAs16 = tf.cast(tensorFloat, dtype=tf.float16)
castedAs16.dtypeOut [4]: