pub struct InvalidDimensionsError<const D: usize, const P: usize> { /* private fields */ }
Expand description
An error indicating failure to do something with a Tensor because the dimension names that were provided did not match with the dimension names that were valid.
Typically this would be due to the same dimension name being provided multiple times, or a dimension name being provided that is not present in the shape of the Tensor in use.
Implementations§
Source§impl<const D: usize, const P: usize> InvalidDimensionsError<D, P>
impl<const D: usize, const P: usize> InvalidDimensionsError<D, P>
Sourcepub fn has_duplicates(&self) -> bool
pub fn has_duplicates(&self) -> bool
Checks if the provided dimensions have duplicate names. This is mainly for internal library use but may also be useful for unit testing.
Sourcepub fn new(
provided: [Dimension; P],
valid: [Dimension; D],
) -> InvalidDimensionsError<D, P>
pub fn new( provided: [Dimension; P], valid: [Dimension; D], ) -> InvalidDimensionsError<D, P>
Constructs an InvalidDimensions for assistance with unit testing.
pub fn provided_names(&self) -> [Dimension; P]
pub fn provided_names_ref(&self) -> &[Dimension; P]
pub fn valid_names(&self) -> [Dimension; D]
pub fn valid_names_ref(&self) -> &[Dimension; D]
Trait Implementations§
Source§impl<const D: usize, const P: usize> Clone for InvalidDimensionsError<D, P>
impl<const D: usize, const P: usize> Clone for InvalidDimensionsError<D, P>
Source§fn clone(&self) -> InvalidDimensionsError<D, P>
fn clone(&self) -> InvalidDimensionsError<D, P>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<const D: usize, const P: usize> Error for InvalidDimensionsError<D, P>
impl<const D: usize, const P: usize> Error for InvalidDimensionsError<D, P>
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl<const D: usize, const P: usize> PartialEq for InvalidDimensionsError<D, P>
impl<const D: usize, const P: usize> PartialEq for InvalidDimensionsError<D, P>
Source§fn eq(&self, other: &InvalidDimensionsError<D, P>) -> bool
fn eq(&self, other: &InvalidDimensionsError<D, P>) -> bool
Tests for
self
and other
values to be equal, and is used by ==
.impl<const D: usize, const P: usize> Eq for InvalidDimensionsError<D, P>
impl<const D: usize, const P: usize> StructuralPartialEq for InvalidDimensionsError<D, P>
Auto Trait Implementations§
impl<const D: usize, const P: usize> Freeze for InvalidDimensionsError<D, P>
impl<const D: usize, const P: usize> RefUnwindSafe for InvalidDimensionsError<D, P>
impl<const D: usize, const P: usize> Send for InvalidDimensionsError<D, P>
impl<const D: usize, const P: usize> Sync for InvalidDimensionsError<D, P>
impl<const D: usize, const P: usize> Unpin for InvalidDimensionsError<D, P>
impl<const D: usize, const P: usize> UnwindSafe for InvalidDimensionsError<D, P>
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