TensorShape

Trait TensorShape 

Source
pub trait TensorShape: Sized {
    // Required method
    fn shape(&self) -> Shape;

    // Provided methods
    fn check_shape(&self, shape: impl Into<Shape>) -> Result<(), TensorError> { ... }
    fn check_shape_any<S>(&self, shapes: &[S]) -> Result<(), TensorError>
       where S: Into<Shape> + ToOwned<Owned = S> { ... }
}

Required Methods§

Source

fn shape(&self) -> Shape

Get the shape of the tensor.

Provided Methods§

Source

fn check_shape(&self, shape: impl Into<Shape>) -> Result<(), TensorError>

Check if the tensor’s shape is the same as what expected.

Source

fn check_shape_any<S>(&self, shapes: &[S]) -> Result<(), TensorError>
where S: Into<Shape> + ToOwned<Owned = S>,

Check if the tensor’s shape matches any of the expected ones.

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§