pub trait TensorLike<T>: Sized {
// Required methods
fn as_raw(&self) -> &[T];
fn as_raw_mut(&mut self) -> &mut [T];
// Provided method
fn elsize() -> usize { ... }
}Expand description
A trait for let the object like a tensor
Required Methods§
Sourcefn as_raw(&self) -> &[T]
fn as_raw(&self) -> &[T]
directly convert the tensor to raw slice
§Note
This function will return a raw slice of the tensor regardless of the shape and strides.
if you do iteration on the view tensor, you may see unexpected results.
Sourcefn as_raw_mut(&mut self) -> &mut [T]
fn as_raw_mut(&mut self) -> &mut [T]
directly convert the tensor to mutable raw slice
§Note
This function will return a mutable raw slice of the tensor regardless of the shape and strides.
if you do iteration on the view tensor, you may see unexpected results.
Provided Methods§
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.