pub fn widen(
source: &TypedTensor<Bf16, DynRank, Host>,
) -> Result<TypedTensor<f32, DynRank, Host>, Error>Expand description
Widen every stored value to f32, which is exact.
§Errors
Returns a validation error carrying
tenferro_tensor_core::ValidationError::ShapeDataLengthMismatch when the
output shape cannot be built, which cannot happen for a shape that already
exists.
§Examples
use tenferro_bf16_proof::{conversion::widen, Bf16};
use tenferro_tensor::{DynRank, Host, TypedTensor};
let source = TypedTensor::<_, DynRank, Host>::from_host_vec_col_major(vec![2], vec![Bf16::from_f32(1.0), Bf16::from_f32(2.5)])?;
let widened = widen(&source)?;
assert_eq!(widened.as_slice(), &[1.0_f32, 2.5]);