diff options
author | Nicolas Patry <patry.nicolas@protonmail.com> | 2023-06-22 13:08:57 +0200 |
---|---|---|
committer | Nicolas Patry <patry.nicolas@protonmail.com> | 2023-06-22 13:08:57 +0200 |
commit | 449af49b5404b96ae19e6926921571c459abb183 (patch) | |
tree | 393fee16e4ba51cfd694b2435d44781a775b4b02 /src/error.rs | |
parent | a8b6c848e010c6cea8710a03b479eb7458d82b52 (diff) | |
download | candle-449af49b5404b96ae19e6926921571c459abb183.tar.gz candle-449af49b5404b96ae19e6926921571c459abb183.tar.bz2 candle-449af49b5404b96ae19e6926921571c459abb183.zip |
Adding size checking when creating a tensor from buffer + shape.
Diffstat (limited to 'src/error.rs')
-rw-r--r-- | src/error.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/error.rs b/src/error.rs index 6f40622c..723edaa1 100644 --- a/src/error.rs +++ b/src/error.rs @@ -12,6 +12,11 @@ pub enum Error { #[error("the candle crate has not been built with cuda support")] NotCompiledWithCudaSupport, + #[error( + "Shape mismatch, got buffer of size {buffer_size} which is compatible with shape {shape:?}" + )] + ShapeMismatch { buffer_size: usize, shape: Shape }, + #[error("shape mismatch in {op}, lhs: {lhs:?}, rhs: {rhs:?}")] ShapeMismatchBinaryOp { lhs: Shape, @@ -40,6 +45,7 @@ pub enum Error { shape: Shape, }, + // TODO this is temporary when we support arbitrary matmul #[error("temporary error where matmul doesn't support arbitrary striding")] UnexpectedStriding, |