pub struct Shape(/* private fields */);Expand description
Tensor shape (list of dimensions).
Implementations§
Source§impl Shape
impl Shape
Sourcepub fn new(dims: impl IntoIterator<Item = Dim>) -> Self
pub fn new(dims: impl IntoIterator<Item = Dim>) -> Self
Creates a new shape from dimensions.
Sourcepub fn from_static(dims: impl IntoIterator<Item = usize>) -> Self
pub fn from_static(dims: impl IntoIterator<Item = usize>) -> Self
Creates a shape from static dimensions.
Sourcepub fn num_elements(&self) -> Option<usize>
pub fn num_elements(&self) -> Option<usize>
Returns the total number of elements (if statically known).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Shape
impl<'de> Deserialize<'de> for Shape
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Shape
impl StructuralPartialEq for Shape
Auto Trait Implementations§
impl Freeze for Shape
impl RefUnwindSafe for Shape
impl Send for Shape
impl Sync for Shape
impl Unpin for Shape
impl UnsafeUnpin for Shape
impl UnwindSafe for Shape
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