pub struct TensorView {
pub dtype: DType,
pub shape: Vec<usize>,
pub strides: Vec<usize>,
pub buf: TensorBuf,
pub offset: usize,
pub len: usize,
}Fields§
§dtype: DType§shape: Vec<usize>§strides: Vec<usize>§buf: TensorBuf§offset: usize§len: usizeImplementations§
Source§impl TensorView
impl TensorView
pub fn from_f32(data: Vec<f32>, shape: Vec<usize>) -> Self
pub fn from_external( bytes: Arc<[u8]>, dtype: DType, shape: Vec<usize>, offset: usize, len: usize, ) -> Self
pub fn as_f32_slice(&self) -> Result<&[f32], EngineError>
pub fn to_f32_vec(&self) -> Result<Vec<f32>, EngineError>
Trait Implementations§
Source§impl Clone for TensorView
impl Clone for TensorView
Source§fn clone(&self) -> TensorView
fn clone(&self) -> TensorView
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TensorView
impl RefUnwindSafe for TensorView
impl Send for TensorView
impl Sync for TensorView
impl Unpin for TensorView
impl UnsafeUnpin for TensorView
impl UnwindSafe for TensorView
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more