pub trait TensorViewable {
// Required methods
fn view(&self, slices: Vec<SliceSpec>) -> Result<TensorView, String>;
fn stride(&self, strides: Vec<isize>) -> Result<TensorView, String>;
fn reshape_view(&self, new_shape: Vec<usize>) -> Result<TensorView, String>;
// Provided methods
fn slice(&self, ranges: &[Range<usize>]) -> Result<TensorView, String> { ... }
fn at(&self, indices: &[usize]) -> Result<TensorView, String> { ... }
}Expand description
Trait for tensors that support zero-copy views
Required Methods§
Sourcefn view(&self, slices: Vec<SliceSpec>) -> Result<TensorView, String>
fn view(&self, slices: Vec<SliceSpec>) -> Result<TensorView, String>
Create a view of this tensor
Sourcefn reshape_view(&self, new_shape: Vec<usize>) -> Result<TensorView, String>
fn reshape_view(&self, new_shape: Vec<usize>) -> Result<TensorView, String>
Reshape view (if possible without copying)