-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#6136: Add backward support for unary LE and GE
- Loading branch information
1 parent
d9b88b0
commit 2e3e208
Showing
6 changed files
with
116 additions
and
0 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
28 changes: 28 additions & 0 deletions
28
tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_ge.py
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,28 @@ | ||
# SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. | ||
|
||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
import torch | ||
import pytest | ||
import tt_lib | ||
from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import data_gen_pt_tt, compare_results | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"input_shapes", | ||
( | ||
(torch.Size([1, 1, 32, 32])), | ||
(torch.Size([1, 1, 320, 384])), | ||
(torch.Size([1, 3, 320, 384])), | ||
), | ||
) | ||
def test_bw_unary_ge(input_shapes, device): | ||
grad_data, grad_tensor = data_gen_pt_tt(input_shapes, device) | ||
tt_output_tensor_on_device = tt_lib.tensor.ge_bw(grad_tensor) | ||
|
||
pyt_y = torch.zeros_like(grad_data) | ||
|
||
golden_tensor = [pyt_y] | ||
|
||
comp_pass = compare_results(tt_output_tensor_on_device, golden_tensor) | ||
assert comp_pass |
28 changes: 28 additions & 0 deletions
28
tests/tt_eager/python_api_testing/unit_testing/backward_ops/test_backward_le.py
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,28 @@ | ||
# SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. | ||
|
||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
import torch | ||
import pytest | ||
import tt_lib | ||
from tests.tt_eager.python_api_testing.unit_testing.backward_ops.utility_funcs import data_gen_pt_tt, compare_results | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"input_shapes", | ||
( | ||
(torch.Size([1, 1, 32, 32])), | ||
(torch.Size([1, 1, 320, 384])), | ||
(torch.Size([1, 3, 320, 384])), | ||
), | ||
) | ||
def test_bw_unary_le(input_shapes, device): | ||
grad_data, grad_tensor = data_gen_pt_tt(input_shapes, device) | ||
tt_output_tensor_on_device = tt_lib.tensor.le_bw(grad_tensor) | ||
|
||
pyt_y = torch.zeros_like(grad_data) | ||
|
||
golden_tensor = [pyt_y] | ||
|
||
comp_pass = compare_results(tt_output_tensor_on_device, golden_tensor) | ||
assert comp_pass |
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