pub struct TensorView<'a, T, const N: usize, A: TensorAllocator> {
pub storage: &'a TensorStorage<T, A>,
pub shape: [usize; N],
pub strides: [usize; N],
}
Expand description
A view into a tensor.
Fields§
§storage: &'a TensorStorage<T, A>
Reference to the storage held by the another tensor.
shape: [usize; N]
The shape of the tensor.
strides: [usize; N]
The strides of the tensor.
Implementations§
Source§impl<'a, T, const N: usize, A: TensorAllocator + 'static> TensorView<'a, T, N, A>
impl<'a, T, const N: usize, A: TensorAllocator + 'static> TensorView<'a, T, N, A>
Sourcepub fn get_unchecked(&self, index: [usize; N]) -> &T
pub fn get_unchecked(&self, index: [usize; N]) -> &T
Sourcepub fn as_contiguous(&self) -> Tensor<T, N, CpuAllocator>where
T: Clone,
pub fn as_contiguous(&self) -> Tensor<T, N, CpuAllocator>where
T: Clone,
Convert the view an owned tensor with contiguous memory.
§Returns
A new Tensor
instance with contiguous memory.
Auto Trait Implementations§
impl<'a, T, const N: usize, A> Freeze for TensorView<'a, T, N, A>
impl<'a, T, const N: usize, A> RefUnwindSafe for TensorView<'a, T, N, A>where
A: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, T, const N: usize, A> Send for TensorView<'a, T, N, A>
impl<'a, T, const N: usize, A> Sync for TensorView<'a, T, N, A>
impl<'a, T, const N: usize, A> Unpin for TensorView<'a, T, N, A>
impl<'a, T, const N: usize, A> UnwindSafe for TensorView<'a, T, N, A>where
A: RefUnwindSafe,
T: RefUnwindSafe,
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