warp.utils.array_cast#
- warp.utils.array_cast(in_array, out_array, count=None)[source]#
Cast elements from one array to another array with a different data type.
This function performs element-wise casting from the input array to the output array. The arrays must have the same number of dimensions and data type shapes. If they don’t match, the arrays will be flattened and casting will be performed at the scalar level.
- Parameters:
- Raises:
RuntimeError – If arrays have different devices or if attempting partial casting on multi-dimensional arrays.
Note
If the input and output arrays have the same data type, this function will simply copy the data without any conversion.