#[non_exhaustive]pub enum CreationError {
Shape(ShapeError),
InvalidStep {
step: f32,
},
NonFiniteBound {
start: f32,
end: f32,
},
}Expand description
arange/linspace 専用のエラー型。shape(要素数)起因の
不整合は Tensor::zeros 等と同じ ShapeError へ委譲し
(From<ShapeError> 実装)、引数自体の不正(step == 0・非有限値)
は ShapeError の対象外であるため本型で新設する
(rng::RngError と同型の設計。イシュー #1726)。
#[non_exhaustive]: RngError/ShapeError と同じ理由(公開 API
非破壊。.claude/rules/security.md)で後続の検査項目追加に備える。
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Shape(ShapeError)
shape 起因の不整合(要素数積のオーバーフロー等)。
InvalidStep
arange の step がゼロまたは非有限(NaN/±inf)。
NonFiniteBound
arange/linspace の start/end が非有限(NaN/±inf)。
Trait Implementations§
Source§impl Clone for CreationError
impl Clone for CreationError
Source§fn clone(&self) -> CreationError
fn clone(&self) -> CreationError
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 CreationError
impl Debug for CreationError
Source§impl Display for CreationError
impl Display for CreationError
Source§impl Error for CreationError
impl Error for CreationError
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 From<ShapeError> for CreationError
impl From<ShapeError> for CreationError
Source§fn from(err: ShapeError) -> CreationError
fn from(err: ShapeError) -> CreationError
Converts to this type from the input type.
Source§impl PartialEq for CreationError
impl PartialEq for CreationError
impl StructuralPartialEq for CreationError
Auto Trait Implementations§
impl Freeze for CreationError
impl RefUnwindSafe for CreationError
impl Send for CreationError
impl Sync for CreationError
impl Unpin for CreationError
impl UnsafeUnpin for CreationError
impl UnwindSafe for CreationError
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more