pub fn cast<T, U>(x: T) -> UExpand description
Converts between element types with the semantics of XLA’s convert on
CPU:
- from complex to other types: the real part is converted (as
lax.convert_element_typelowers it); - to complex: the real part is converted, and the imaginary part is 0;
- to
bool: nonzero (and NaN) istrue; - float to integer: rounds toward zero and saturates; NaN is 0;
- integer to integer: wraps around;
- to
f32andf64: rounded once; - to
f16andbf16: rounded throughf32, as XLA does.