pub trait Float: Num {
const ZERO: Self;
const ONE: Self;
// Required method
fn from_f64(value: f64) -> Self;
}Expand description
Floating-point dtypes.
Required Associated Constants§
Required Methods§
Sourcefn from_f64(value: f64) -> Self
fn from_f64(value: f64) -> Self
Materialize a scalar constant of this float type from an f64 literal.
Kernels are generic over D: Float, so they cannot use bare f32/f64
literals when building constant tensors (e.g. T::full(shape, value: D)).
from_f64 provides the one hook needed to construct arbitrary constants
generically; each concrete float type narrows/keeps the value as needed.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".