-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adding functionality for logical_and.reduce() with appropriate modifications in tests \n\n Joseph Guman <[email protected]> * Minor style change to test for logical_and.reduce() \n\nSigned-off-by: Joseph Guman <[email protected]> * Style changes and adding logical_or.reduce() functionality with UnaryRedCode.ANY Signed-off-by: Joseph Guman <[email protected]> * Minor fixes --------- Co-authored-by: Joseph Thomas Guman <[email protected]> Co-authored-by: Manolis Papadakis <[email protected]> Co-authored-by: Manolis Papadakis <[email protected]>
- Loading branch information
1 parent
788fed0
commit 9ece0a3
Showing
4 changed files
with
47 additions
and
2 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import numpy as np | ||
import pytest | ||
|
||
import cunumeric as num | ||
|
||
|
||
@pytest.mark.parametrize("axis", [None, 0, 1, 2, (0, 1, 2)]) | ||
def test_logical_reductions(axis): | ||
input = [[[12, 0, 1, 2], [9, 0, 0, 1]], [[0, 0, 0, 5], [1, 1, 1, 1]]] | ||
in_num = num.array(input) | ||
in_np = np.array(input) | ||
|
||
out_num = num.logical_and.reduce(in_num, axis=axis) | ||
out_np = np.logical_and.reduce(in_np, axis=axis) | ||
assert num.array_equal(out_num, out_np) | ||
|
||
out_num = num.logical_or.reduce(in_num, axis=axis) | ||
out_np = np.logical_or.reduce(in_np, axis=axis) | ||
assert num.array_equal(out_num, out_np) | ||
|
||
|
||
if __name__ == "__main__": | ||
import sys | ||
|
||
sys.exit(pytest.main(sys.argv)) |