TensorInit

Trait TensorInit 

Source
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§

Source

fn from_data<'a, S, D>(shape: S, data: D) -> Result<Self, TensorError>
where S: Into<Shape>, D: Into<Cow<'a, [T]>>,

Init the tensor with given shape and contents.

Source

fn init(shape: impl Into<Shape>) -> Self

Init the tensor with given shape.

Provided Methods§

Source

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.

Implementors§