use std::error::Error;
use std::fmt;
use std::fmt::Display;
#[derive(Clone, Debug, PartialEq)]
pub enum GemmError {
BatchSizeMismatch,
KSizeMismatch,
WrongBiasSize,
WrongQuantParamSize,
OutputSizeMismatch,
PackedDataKernelMismatch,
PackedDataBlockingMismatch,
}
impl Display for GemmError {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
match self {
Self::BatchSizeMismatch => {
write!(fmt, "batches of `a` and `b` matrices must have same length")
}
Self::KSizeMismatch => {
write!(fmt, "columns of matrix `a` must match rows of matrix `b`")
}
Self::WrongBiasSize => write!(fmt, "bias vector length is incorrect"),
Self::WrongQuantParamSize => {
write!(fmt, "quantization parameter size does not match input")
}
Self::OutputSizeMismatch => write!(fmt, "output buffer has wrong length"),
Self::PackedDataKernelMismatch => {
write!(fmt, "matrix was packed with a different kernel")
}
Self::PackedDataBlockingMismatch => {
write!(fmt, "matrix was packed with a different blocking size")
}
}
}
}
impl Error for GemmError {}