pub trait FloatProtoElem: Copy + 'static {
// Required methods
fn slice_into_tensor_dyn(
values: &[Self],
shape: &[usize],
) -> Result<TensorDyn>;
fn arrayview3_into_tensor_dyn(
view: ArrayView3<'_, Self>,
) -> Result<TensorDyn>;
}Expand description
Per-float-dtype construction of an edgefirst_tensor::TensorDyn from a
flat slice or a 3-D ArrayView. Each implementor either passes its element
type straight to Tensor::from_slice / Tensor::from_arrayview3, or
narrows f64 to f32 — there is no native f64 kernel path, so f64 protos
lose precision here rather than at some later, less obvious point.
Implemented for f32, f64, and half::f16. It is public because it
appears in the bounds of the proto-extraction paths; there is no reason to
implement it outside this crate.
Required Methods§
Sourcefn slice_into_tensor_dyn(values: &[Self], shape: &[usize]) -> Result<TensorDyn>
fn slice_into_tensor_dyn(values: &[Self], shape: &[usize]) -> Result<TensorDyn>
Wrap a flat slice with the given shape as a tensor of this element
type.
Sourcefn arrayview3_into_tensor_dyn(view: ArrayView3<'_, Self>) -> Result<TensorDyn>
fn arrayview3_into_tensor_dyn(view: ArrayView3<'_, Self>) -> Result<TensorDyn>
Wrap a 3-D ArrayView (the proto-mask layout) as a tensor of this
element type.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".