From 8619aa3312834cccc75d000ab8eed35bc86f6e58 Mon Sep 17 00:00:00 2001 From: gonzalesmk Date: Wed, 20 Sep 2023 14:06:47 -0300 Subject: [PATCH] add alloc extern crate --- burn-candle/src/lib.rs | 1 + burn-tch/src/lib.rs | 2 ++ burn-tensor/src/tests/ops/cat.rs | 9 +++++++++ burn-wgpu/src/lib.rs | 1 + 4 files changed, 13 insertions(+) diff --git a/burn-candle/src/lib.rs b/burn-candle/src/lib.rs index 3cc8ec3074..29fe72ecab 100644 --- a/burn-candle/src/lib.rs +++ b/burn-candle/src/lib.rs @@ -15,6 +15,7 @@ pub use tensor::*; #[cfg(test)] mod tests { + extern crate alloc; use super::*; pub type TestBackend = CandleBackend; diff --git a/burn-tch/src/lib.rs b/burn-tch/src/lib.rs index 008f12e0f1..1111347daf 100644 --- a/burn-tch/src/lib.rs +++ b/burn-tch/src/lib.rs @@ -14,6 +14,8 @@ pub use tensor::*; #[cfg(test)] mod tests { + extern crate alloc; + type TestBackend = crate::TchBackend; type TestTensor = burn_tensor::Tensor; type TestTensorInt = burn_tensor::Tensor; diff --git a/burn-tensor/src/tests/ops/cat.rs b/burn-tensor/src/tests/ops/cat.rs index e7b7c8ef0f..6b9a99817c 100644 --- a/burn-tensor/src/tests/ops/cat.rs +++ b/burn-tensor/src/tests/ops/cat.rs @@ -1,6 +1,7 @@ #[burn_tensor_testgen::testgen(cat)] mod tests { use super::*; + use alloc::vec::Vec; use burn_tensor::{Bool, Data, Int, Tensor}; #[test] @@ -57,4 +58,12 @@ mod tests { let data_expected = Data::from([[[1.0, 2.0, 3.0]], [[1.1, 2.1, 3.1]], [[4.0, 5.0, 6.0]]]); data_expected.assert_approx_eq(&data_actual, 3); } + + #[test] + #[should_panic] + fn should_panic_when_list_of_vectors_is_empty() { + let tensor: Vec> = vec![]; + + TestTensor::cat(tensor, 0).into_data(); + } } diff --git a/burn-wgpu/src/lib.rs b/burn-wgpu/src/lib.rs index ce43182aad..32dc2659bf 100644 --- a/burn-wgpu/src/lib.rs +++ b/burn-wgpu/src/lib.rs @@ -4,6 +4,7 @@ #[macro_use] extern crate derive_new; +extern crate alloc; mod ops;