-
Notifications
You must be signed in to change notification settings - Fork 489
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
bool()
op for numerical tensor (#1402)
Fixes #1395
- Loading branch information
Showing
7 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#[burn_tensor_testgen::testgen(bool)] | ||
mod tests { | ||
use super::*; | ||
use burn_tensor::{Data, Tensor}; | ||
|
||
#[test] | ||
fn test_from_float() { | ||
let tensor1 = TestTensor::from([[0.0, 43.0, 0.0], [2.0, -4.2, 31.33]]); | ||
let data_actual = tensor1.bool().into_data(); | ||
let data_expected = Data::from([[false, true, false], [true, true, true]]); | ||
assert_eq!(data_expected, data_actual); | ||
} | ||
|
||
#[test] | ||
fn test_from_int() { | ||
let tensor1 = TestTensorInt::from([[0, 43, 0], [2, -4, 31]]); | ||
let data_actual = tensor1.bool().into_data(); | ||
let data_expected = Data::from([[false, true, false], [true, true, true]]); | ||
assert_eq!(data_expected, data_actual); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ mod arange; | |
mod arange_step; | ||
mod arg; | ||
mod argwhere_nonzero; | ||
mod bool; | ||
mod cast; | ||
mod cat; | ||
mod chunk; | ||
|