kornia_tensor_ops/
error.rs

1use kornia_tensor::TensorError;
2use thiserror::Error;
3
4/// An error type for tensor operations.
5#[derive(Error, Debug, PartialEq)]
6pub enum TensorOpsError {
7    /// The dimension to perform the operation over is greater than the number of dimsions of the tensor.
8    #[error("Dimension out of bounds. The dimension {0} is out of bounds ({1}).")]
9    DimOutOfBounds(usize, usize),
10
11    /// Length mismatch for vector operations
12    #[error("Length mismatch: expected equal length vectors, got {0} and {1}")]
13    LengthMismatch(usize, usize),
14
15    /// Shape mismatch
16    #[error("Shape mismatch: {0:?} != {1:?}")]
17    ShapeMismatch(Vec<usize>, Vec<usize>),
18
19    /// Tensor error
20    #[error("Error with the tensor: {0}")]
21    TensorError(#[from] TensorError),
22}