use thiserror::Error;
pub type Result<T> = std::result::Result<T, RustyGradientsError>;
#[derive(Error, Debug)]
pub enum RustyGradientsError {
#[error("Incompatible shapes for operation: {0}")]
ShapeError(String),
#[error("Operation requires a tensor with {expected} dimensions, but got {actual}")]
DimensionError { expected: usize, actual: usize },
#[error("Cannot create tensor with shape {shape:?} from slice of length {slice_len}")]
ShapeCreationError {
shape: Vec<usize>,
slice_len: usize,
},
#[error("Invalid axis dimension: expected {expected} for axis {axis}, but got {actual}")]
AxisDimensionError {
axis: usize,
expected: usize,
actual: usize,
},
#[error("Invalid input: {0}")]
InvalidInput(String),
#[error("Serialization error: {0}")]
SerializationError(String),
#[error("IO error: {0}")]
IoError(String),
}