Skip to content

Commit

Permalink
add alloc extern crate
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzalesMK committed Sep 20, 2023
1 parent bb84984 commit 8619aa3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions burn-candle/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub use tensor::*;

#[cfg(test)]
mod tests {
extern crate alloc;
use super::*;

pub type TestBackend = CandleBackend<f32, i64>;
Expand Down
2 changes: 2 additions & 0 deletions burn-tch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ pub use tensor::*;

#[cfg(test)]
mod tests {
extern crate alloc;

type TestBackend = crate::TchBackend<f32>;
type TestTensor<const D: usize> = burn_tensor::Tensor<TestBackend, D>;
type TestTensorInt<const D: usize> = burn_tensor::Tensor<TestBackend, D, burn_tensor::Int>;
Expand Down
9 changes: 9 additions & 0 deletions burn-tensor/src/tests/ops/cat.rs
Original file line number Diff line number Diff line change
@@ -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]
Expand Down Expand Up @@ -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<TestTensor<2>> = vec![];

TestTensor::cat(tensor, 0).into_data();
}
}
1 change: 1 addition & 0 deletions burn-wgpu/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#[macro_use]
extern crate derive_new;
extern crate alloc;

mod ops;

Expand Down

0 comments on commit 8619aa3

Please sign in to comment.