pub trait TensorInit<T: Scalar>: Sized {
// Required methods
fn from_data<'a, S, D>(shape: S, data: D) -> Result<Self, TensorError>
where S: Into<Shape>,
D: Into<Cow<'a, [T]>>;
fn init(shape: impl Into<Shape>) -> Self;
// Provided method
fn from_data_1d<'a>(data: impl Into<Cow<'a, [T]>>) -> Self { ... }
}Required Methods§
Sourcefn from_data<'a, S, D>(shape: S, data: D) -> Result<Self, TensorError>
fn from_data<'a, S, D>(shape: S, data: D) -> Result<Self, TensorError>
Init the tensor with given shape and contents.
Provided Methods§
Sourcefn from_data_1d<'a>(data: impl Into<Cow<'a, [T]>>) -> Self
fn from_data_1d<'a>(data: impl Into<Cow<'a, [T]>>) -> Self
Init an 1-D tensor from data.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.