Skip to contents

Reinterprets the bits of a tensor as a different data type without modifying the underlying data. If the target type is narrower, an extra trailing dimension is added; if wider, the last dimension is consumed.

Usage

nv_bitcast_convert(operand, dtype)

Arguments

operand

(tensorish)
Operand.

dtype

(character(1) | stablehlo::TensorDataType)
Target data type.

Value

tensorish
Has the given dtype.

See also

nvl_bitcast_convert() for the underlying primitive, nv_convert() for value-preserving type conversion.

Examples

jit_eval({
  x <- nv_tensor(1L)
  nvl_bitcast_convert(x, dtype = "i8")
})
#> AnvilTensor
#>  1 0 0 0
#> [ CPUi8{1,4} ]