pub struct TensorView { /* private fields */ }Expand description
A view into a tensor
Implementations§
Source§impl TensorView
impl TensorView
Sourcepub fn new(tensor: Tensor, shape: &[usize], offsets: &[usize]) -> Self
pub fn new(tensor: Tensor, shape: &[usize], offsets: &[usize]) -> Self
Create a view into the given tensor
pub fn tensor(&self) -> &Tensor
pub fn offsets(&self) -> &Offsets
pub fn is_full_view(&self) -> bool
pub fn from_output_partition( tensor: Tensor, output_rank: usize, partition_dim: usize, partition_offset: usize, partition_len: usize, ) -> Self
pub fn from_output_partitions( tensor: Tensor, output_rank: usize, partitions: &[DimPartition], ) -> Self
Sourcepub fn from_output_partitions_on_view(
base_view: &TensorView,
output_rank: usize,
partitions: &[DimPartition],
) -> Self
pub fn from_output_partitions_on_view( base_view: &TensorView, output_rank: usize, partitions: &[DimPartition], ) -> Self
Create a view by applying output partitions to an existing base view.
This preserves the base view’s offsets and shape constraints.
pub fn num_bytes(&self) -> usize
Sourcepub fn element_offset(&self) -> Result<usize, SimError>
pub fn element_offset(&self) -> Result<usize, SimError>
Return the offset of the first element (in number of elements)
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 moreSource§impl Debug for TensorView
impl Debug for TensorView
Auto 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