pub trait TensorTrait<T>: Send + Sync{
// Required methods
fn new(shape: &[usize], name: Option<&str>) -> Result<Self>
where Self: Sized;
fn memory(&self) -> TensorMemory;
fn name(&self) -> String;
fn shape(&self) -> &[usize];
fn reshape(&mut self, shape: &[usize]) -> Result<()>;
fn map(&self) -> Result<TensorMap<T>>;
// Provided methods
fn len(&self) -> usize { ... }
fn is_empty(&self) -> bool { ... }
fn size(&self) -> usize { ... }
}Required Methods§
Sourcefn new(shape: &[usize], name: Option<&str>) -> Result<Self>where
Self: Sized,
fn new(shape: &[usize], name: Option<&str>) -> Result<Self>where
Self: Sized,
Create a new tensor with the given shape and optional name. If no name is given, a random name will be generated.
Sourcefn memory(&self) -> TensorMemory
fn memory(&self) -> TensorMemory
Get the memory type of this tensor.