-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#8635: Add test and sweep to demonstrate ttnn.empty failing with last…
… odd dimension
- Loading branch information
1 parent
61a30c6
commit e5ead49
Showing
5 changed files
with
117 additions
and
24 deletions.
There are no files selected for viewing
89 changes: 89 additions & 0 deletions
89
tests/ttnn/python_api_testing/non_working_unit_tests/wormhole/test_empty.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,89 @@ | ||
# SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. | ||
|
||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
from loguru import logger | ||
import random | ||
import pytest | ||
import torch | ||
import ttnn | ||
|
||
from tests.ttnn.utils_for_testing import assert_with_pcc | ||
from tests.ttnn.python_api_testing.sweep_tests import ttnn_ops | ||
|
||
|
||
def run_empty_tests(input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed, device): | ||
torch.manual_seed(data_seed) | ||
|
||
x = torch.Tensor(size=input_shape[0]).uniform_(-100, 100).to(torch.bfloat16) | ||
|
||
try: | ||
# get ref result | ||
ref_value = torch.empty(x.shape) | ||
|
||
tt_result = ttnn_ops.empty( | ||
x, | ||
device=device, | ||
dtype=dtype, | ||
layout=dlayout, | ||
input_mem_config=in_mem_config, | ||
output_mem_config=output_mem_config, | ||
) | ||
|
||
except Exception as e: | ||
logger.warning(f"Operation execution crashed") | ||
raise e | ||
|
||
assert len(tt_result.shape) == len(ref_value.shape) | ||
|
||
|
||
test_sweep_args = [ | ||
( | ||
[(4, 7, 21, 133)], | ||
[ttnn.bfloat16], | ||
[ttnn.TILE_LAYOUT], | ||
[ttnn.DRAM_MEMORY_CONFIG], | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
4171614, | ||
), | ||
( | ||
[(5, 3, 145, 71)], | ||
[ttnn.bfloat16], | ||
[ttnn.TILE_LAYOUT], | ||
[ttnn.DRAM_MEMORY_CONFIG], | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
4171614, | ||
), | ||
( | ||
[(5, 3, 145, 72)], | ||
[ttnn.bfloat16], | ||
[ttnn.TILE_LAYOUT], | ||
[ttnn.DRAM_MEMORY_CONFIG], | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
4171614, | ||
), | ||
( | ||
[(4, 9, 52, 181)], | ||
[ttnn.bfloat16], | ||
[ttnn.TILE_LAYOUT], | ||
[ttnn.DRAM_MEMORY_CONFIG], | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
4171614, | ||
), | ||
( | ||
[(6, 6, 98, 125)], | ||
[ttnn.bfloat16], | ||
[ttnn.TILE_LAYOUT], | ||
[ttnn.DRAM_MEMORY_CONFIG], | ||
(ttnn.DRAM_MEMORY_CONFIG), | ||
4171614, | ||
), | ||
] | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed", | ||
(test_sweep_args), | ||
) | ||
def test_eltwise_empty(input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed, device): | ||
run_empty_tests(input_shape, dtype, dlayout, in_mem_config, output_mem_config, data_seed, device) |
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