-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Single test_softmax function which tests all shapes. - Testing dev_data_format and math_fidelity is also covered. - Add test_softmax_inconsistency function which tests inconsistency between the same test data but in different order.
- Loading branch information
1 parent
40fb4e6
commit 62a79cf
Showing
4 changed files
with
508 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# SPDX-FileCopyrightText: © 2024 Tenstorrent AI ULC | ||
|
||
# SPDX-License-Identifier: Apache-2.0 |
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,59 @@ | ||
# SPDX-FileCopyrightText: © 2024 Tenstorrent AI ULC | ||
|
||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
|
||
def pytest_configure(config): | ||
config.addinivalue_line("markers", 'slow: marks tests as slow (deselect with -m "not slow")') | ||
config.addinivalue_line("markers", 'run_in_pp: marks tests to run in pipeline (select with -m "run_in_pp")') | ||
|
||
|
||
def pytest_addoption(parser): | ||
# softmax_model | ||
parser.addoption( | ||
"--softmax_model", | ||
action="store", | ||
default="ModelFromAnotherOp", | ||
help="The name of the model type.", | ||
) | ||
# softmax_input_shape_dim | ||
parser.addoption( | ||
"--softmax_input_shape_dim", | ||
action="store", | ||
default=((1, 4), 1), | ||
help="Shape of the tensor and dim parameter for the operation.", | ||
) | ||
# softmax_dev_data_format | ||
parser.addoption( | ||
"--df", | ||
action="store", | ||
default=((1, 4), 1), | ||
help="Dev data format for the operation.", | ||
) | ||
# softmax_math_fidelity | ||
parser.addoption( | ||
"--mf", | ||
action="store", | ||
default=((1, 4), 1), | ||
help="Math Fidelity for the operation.", | ||
) | ||
|
||
|
||
def pytest_generate_tests(metafunc): | ||
|
||
option_model = metafunc.config.option.softmax_model | ||
if "softmax_model" in metafunc.fixturenames and option_model is not None: | ||
metafunc.parametrize("softmax_model", [option_model]) | ||
|
||
option_shape_dim = metafunc.config.option.softmax_input_shape_dim | ||
if "softmax_input_shape_dim" in metafunc.fixturenames and option_shape_dim is not None: | ||
input_shape_dim = eval(option_shape_dim) if isinstance(option_shape_dim, str) else option_shape_dim | ||
metafunc.parametrize("softmax_input_shape_dim", [input_shape_dim]) | ||
|
||
option_df = metafunc.config.option.df | ||
if "df" in metafunc.fixturenames and option_df is not None: | ||
metafunc.parametrize("df", [option_df]) | ||
|
||
option_mf = metafunc.config.option.mf | ||
if "mf" in metafunc.fixturenames and option_mf is not None: | ||
metafunc.parametrize("mf", [option_mf]) |
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,10 @@ | ||
# SPDX-FileCopyrightText: © 2024 Tenstorrent AI ULC | ||
|
||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# Commands for running softmax tests | ||
|
||
|
||
# Run single test with specific parameters: | ||
pytest -svv test_softmax.py::test_softmax_single_params --softmax_model 'ModelFromAnotherOp' --softmax_input_shape_dim '((1, 1), 0)' --df 'Float16_b' --mf 'HiFi4' --runxfail --no-skips | ||
pytest -svv test_softmax.py::test_softmax_single_params --softmax_model 'ModelFromHost' --softmax_input_shape_dim '(45, 17), 0' --df 'Float16_b' --mf 'HiFi4' --runxfail --no-skips |
Oops, something went wrong.