pub enum ShapeError {
Show 16 variants
InvalidSize {
message: String,
location: &'static Location<'static>,
},
InvalidDimension {
message: String,
location: &'static Location<'static>,
},
BroadcastError {
message: String,
location: &'static Location<'static>,
},
MatmulMismatch {
lhs: Shape,
rhs: Shape,
expected: i64,
location: &'static Location<'static>,
},
DimMismatch {
expected: usize,
actual: usize,
location: &'static Location<'static>,
},
DimOutOfRange {
expected: Range<i64>,
actual: i64,
location: &'static Location<'static>,
},
GeomSpaceError {
start: f64,
end: f64,
location: &'static Location<'static>,
},
ConcatDimMismatch {
expected: usize,
actual: usize,
location: &'static Location<'static>,
},
NdimNotEnough {
message: String,
expected: usize,
actual: usize,
location: &'static Location<'static>,
},
SqueezeError {
axis: usize,
shape: Shape,
location: &'static Location<'static>,
},
ContiguousError {
message: String,
shape: Shape,
strides: Strides,
location: &'static Location<'static>,
},
ConvError {
message: String,
location: &'static Location<'static>,
},
TopkError {
message: String,
location: &'static Location<'static>,
},
InplaceReshapeError {
message: String,
location: &'static Location<'static>,
},
ExpandError {
old_dim: i64,
location: &'static Location<'static>,
},
InvalidShape {
message: String,
location: &'static Location<'static>,
},
}Expand description
Errors related to tensor shapes and dimensions
Variants§
InvalidSize
Error that occurs when there is size problem
Fields
InvalidDimension
Error that occurs when the dimension of a tensor is invalid
Fields
BroadcastError
Error that occurs when broadcasting fails
Fields
MatmulMismatch
Error that occurs when the shape of two tensors does not match for matrix multiplication
Fields
DimMismatch
Error that occurs when the dimension of two tensors does not match
Fields
DimOutOfRange
Error that occurs when the dimension is out of range
Fields
GeomSpaceError
Error that occurs when geomspace parameters are invalid
Fields
ConcatDimMismatch
Error that occurs when concat dimensions don’t match
Fields
NdimNotEnough
Error that occurs when the number of dimensions of a tensor is less than the expected value
Fields
SqueezeError
Error that occurs when the axis is not 1
Fields
ContiguousError
Error that occurs when the tensor is not contiguous
Fields
ConvError
Error that occurs when the input shape is invalid for conv2d
Fields
TopkError
Error that occurs when the topk operation is invalid
Fields
InplaceReshapeError
Error that occurs when the inplace reshape is invalid
Fields
ExpandError
Error that occurs when the dimention to expand is not 1
InvalidShape
Error that occurs when the shape is invalid
Implementations§
Source§impl ShapeError
impl ShapeError
Sourcepub fn check_matmul(lhs: &Shape, rhs: &Shape) -> Result<(), Self>
pub fn check_matmul(lhs: &Shape, rhs: &Shape) -> Result<(), Self>
Check if the shapes of two tensors match for matrix multiplication
Sourcepub fn check_dim(expected: usize, actual: usize) -> Result<(), Self>
pub fn check_dim(expected: usize, actual: usize) -> Result<(), Self>
Check if the dimensions of two tensors match
Sourcepub fn check_ndim_enough(
msg: String,
expected: usize,
actual: usize,
) -> Result<(), Self>
pub fn check_ndim_enough( msg: String, expected: usize, actual: usize, ) -> Result<(), Self>
Check if the number of dimensions of a tensor is greater than the expected value
Sourcepub fn check_contiguous(msg: String, layout: &Layout) -> Result<(), Self>
pub fn check_contiguous(msg: String, layout: &Layout) -> Result<(), Self>
Check if the tensor is contiguous
Sourcepub fn check_size_match(expected: i64, actual: i64) -> Result<(), Self>
pub fn check_size_match(expected: i64, actual: i64) -> Result<(), Self>
Check if the size of two tensors match
Sourcepub fn check_size_gt(expected: i64, actual: i64) -> Result<(), Self>
pub fn check_size_gt(expected: i64, actual: i64) -> Result<(), Self>
Check if the size of two tensors match