cast

dragon.vm.tensorflow.cast(
  x,
  dtype,
  name=None
)[source]

Cast the data type of input.

Examples:

x = tf.constant([1, 2, 3], dtype='int64')
print(tf.cast(x, dtype='float32'))
Parameters:
  • x (dragon.Tensor) – The input tensor.
  • dtype (str) – The data type to cast to.
  • name (str, optional) – A optional name for the operation.
Returns:

dragon.Tensor – The output tensor.