-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#13646: Add unit test for channel bcast using repeat
- Loading branch information
1 parent
d6355c9
commit 2cb9d87
Showing
2 changed files
with
27 additions
and
2 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
tests/ttnn/unit_tests/operations/eltwise/test_mul_channel.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,27 @@ | ||
# SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. | ||
|
||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
import pytest | ||
|
||
import torch | ||
|
||
import ttnn | ||
|
||
from tests.ttnn.utils_for_testing import assert_with_pcc | ||
from torch.nn import functional as F | ||
|
||
|
||
@pytest.mark.parametrize("h", [32]) | ||
@pytest.mark.parametrize("w", [64]) | ||
def test_mul_channel_bcast_repeat(device, h, w): | ||
torch_input_tensor_a = torch.rand((16, 16, h, w), dtype=torch.bfloat16) | ||
torch_input_tensor_b = torch.rand((16, 1, h, w), dtype=torch.bfloat16) | ||
torch_output_tensor = torch.mul(torch_input_tensor_a, torch_input_tensor_b) | ||
|
||
input_tensor_a = ttnn.from_torch(torch_input_tensor_a, layout=ttnn.TILE_LAYOUT, device=device) | ||
input_tensor_b = ttnn.from_torch(torch_input_tensor_b, layout=ttnn.TILE_LAYOUT, device=device) | ||
output = ttnn.mul(input_tensor_a, input_tensor_b) | ||
output = ttnn.to_torch(output) | ||
|
||
assert_with_pcc(torch_output_tensor, output, 0.9999) |
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