pub fn cast_tensor(tensor: &Tensor, target_dtype: Symbol) -> Result<Tensor>Expand description
Casts a tensor into target_dtype.
Supported targets are numbers/i64, numbers/f32, numbers/f64,
numbers/f16, and numbers/bf16. Floating-to-integer casts round ties to
even and reject NaN, infinity, and out-of-range results. Floating narrowing
preserves NaN, infinity, and signed zero, and rejects finite overflow into an
infinite result.