pub struct Metadata {
pub shape: Shape,
pub strides: Strides,
}Fields§
§shape: Shape§strides: StridesImplementations§
Source§impl Metadata
impl Metadata
pub fn new(shape: impl Into<Shape>, strides: impl Into<Strides>) -> Metadata
pub fn shape(&self) -> &Shape
pub fn shape_mut(&mut self) -> &mut Shape
pub fn strides(&self) -> &Strides
pub fn strides_mut(&mut self) -> &mut Strides
pub fn rank(&self) -> usize
pub fn num_dims(&self) -> usize
Sourcepub fn num_elements(&self) -> usize
pub fn num_elements(&self) -> usize
Returns the total number of elements of a tensor having this shape
pub fn swapped(self, dim0: usize, dim1: usize) -> Metadata
pub fn swap(&mut self, dim0: usize, dim1: usize)
Sourcepub fn permute(&mut self, axes: &[usize]) -> Result<(), MetadataError>
pub fn permute(&mut self, axes: &[usize]) -> Result<(), MetadataError>
Reorder the shape dimensions according to the permutation of axes.
pub fn permuted(self, axes: &[usize]) -> Result<Metadata, MetadataError>
Sourcepub fn insert(&mut self, index: usize, shape: usize, stride: usize)
pub fn insert(&mut self, index: usize, shape: usize, stride: usize)
Insert a dimension of shape with stride at position index.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Metadata
impl<'de> Deserialize<'de> for Metadata
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Metadata, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Metadata, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for Metadata
impl Ord for Metadata
Source§impl PartialOrd for Metadata
impl PartialOrd for Metadata
Source§impl Serialize for Metadata
impl Serialize for Metadata
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Eq for Metadata
impl StructuralPartialEq for Metadata
Auto Trait Implementations§
impl Freeze for Metadata
impl RefUnwindSafe for Metadata
impl Send for Metadata
impl Sync for Metadata
impl Unpin for Metadata
impl UnsafeUnpin for Metadata
impl UnwindSafe for Metadata
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.