pub struct TensorView<'a, T, A: Backend = CpuBackend> { /* private fields */ }Implementations§
Source§impl<'a, T, A: Backend> TensorView<'a, T, A>
impl<'a, T, A: Backend> TensorView<'a, T, A>
pub fn as_ptr(&self) -> *const T
pub fn sizes(&self) -> &[usize]
pub fn backend(&self) -> &A
Sourcepub unsafe fn from_raw_parts(
ptr: *const T,
dimensions: Dimensions,
backend: A,
) -> Self
pub unsafe fn from_raw_parts( ptr: *const T, dimensions: Dimensions, backend: A, ) -> Self
§Safety
The caller must ensure that the pointer is valid for the given dimensions and backend.
pub fn strides(&self) -> &[usize]
pub fn total_len(&self) -> usize
pub fn shape(&self) -> &Dimensions
pub fn flatten(self) -> TensorView<'a, T, A>
pub fn reshape(self, sizes: impl AsRef<[usize]>) -> TensorView<'a, T, A>
pub fn get(self, index: usize) -> Option<Self>
pub fn split(self) -> impl Iterator<Item = Self>
Source§impl<'a, T> TensorView<'a, T, CpuBackend>
impl<'a, T> TensorView<'a, T, CpuBackend>
Trait Implementations§
Source§impl<'a, T, A: Backend> Clone for TensorView<'a, T, A>
impl<'a, T, A: Backend> Clone for TensorView<'a, T, A>
Auto Trait Implementations§
impl<'a, T, A> Freeze for TensorView<'a, T, A>where
A: Freeze,
impl<'a, T, A> RefUnwindSafe for TensorView<'a, T, A>where
A: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, T, A = CpuBackend> !Send for TensorView<'a, T, A>
impl<'a, T, A = CpuBackend> !Sync for TensorView<'a, T, A>
impl<'a, T, A> Unpin for TensorView<'a, T, A>where
A: Unpin,
impl<'a, T, A> UnsafeUnpin for TensorView<'a, T, A>where
A: UnsafeUnpin,
impl<'a, T, A> UnwindSafe for TensorView<'a, T, A>
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