cast

arrayfire.cast(array: Array, dtype: Dtype, /) Array

Cast an array to a specified type.

Parameters

arrayArray

Multi-dimensional arrayfire array to be cast.

dtypeDtype

The target data type to which the array will be cast. Must be one of the following: - Dtype.int8 for signed 8-bit integer - Dtype.int16 for signed 16-bit integer - Dtype.int32 for signed 32-bit integer - Dtype.int64 for signed 64-bit integer - Dtype.uint8 for unsigned 8-bit integer - Dtype.uint16 for unsigned 16-bit integer - Dtype.uint32 for unsigned 32-bit integer - Dtype.uint64 for unsigned 64-bit integer - Dtype.float16 for 16-bit floating-point - Dtype.float32 for 32-bit floating-point - Dtype.float64 for 64-bit floating-point - Dtype.complex64 for 64-bit complex number - Dtype.complex128 for 128-bit complex number - Dtype.bool for boolean

Returns

Array

An array containing the values from array after conversion to the specified dtype.