Start adding some ops.

This commit is contained in:
laurent
2023-06-20 08:41:19 +01:00
parent ef6760117f
commit 7a31ba93e4
5 changed files with 83 additions and 15 deletions

View File

@ -1,10 +1,15 @@
use crate::{DType, Shape};
/// Main library error type.
#[derive(thiserror::Error, Debug)]
pub enum Error {
#[error("invalid shapes in {op}, lhs: {lhs:?}, rhs: {rhs:?}")]
BinaryInvalidShape {
lhs: Vec<usize>,
rhs: Vec<usize>,
#[error("unexpected dtype, expected: {expected:?}, got: {got:?}")]
UnexpectedDType { expected: DType, got: DType },
#[error("shape mismatch in {op}, lhs: {lhs:?}, rhs: {rhs:?}")]
ShapeMismatchBinaryOp {
lhs: Shape,
rhs: Shape,
op: &'static str,
},
@ -12,7 +17,7 @@ pub enum Error {
UnexpectedNumberOfDims {
expected: usize,
got: usize,
shape: Vec<usize>,
shape: Shape,
},
}