Add some specific errors rather than panicking.

This commit is contained in:
laurent
2023-06-22 07:51:53 +01:00
parent db35b31050
commit fc26bab3ed
3 changed files with 14 additions and 8 deletions

View File

@ -6,6 +6,12 @@ pub enum Error {
#[error("unexpected dtype, expected: {expected:?}, got: {got:?}")]
UnexpectedDType { expected: DType, got: DType },
#[error("{op} only supports contiguous tensors")]
RequiresContiguous { op: &'static str },
#[error("the candle crate has not been built with cuda support")]
NotCompiledWithCudaSupport,
#[error("shape mismatch in {op}, lhs: {lhs:?}, rhs: {rhs:?}")]
ShapeMismatchBinaryOp {
lhs: Shape,