cast

dragon.cast(
  inputs,
  dtype,
  **kwargs
)[source]

Cast the data type of input.

Examples:

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

dragon.Tensor – The output tensor.