Skip to content

Commit 61606df

Browse files
committed
Move files from /tests_models to /tests.
1 parent 3d483d8 commit 61606df

16 files changed

Lines changed: 28 additions & 35 deletions

backends/nxp/quantizer/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Copyright (c) Meta Platforms, Inc. and affiliates.
2-
# Copyright 2024-2025 NXP
2+
# Copyright 2024-2026 NXP
33
# All rights reserved.
44
#
55
# This source code is licensed under the BSD-style license found in the
File renamed without changes.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
# TODO(Robert Kalmar) In accordance with the "TODO(dbort): Prune /test[s]/ dirs, /third-party/ dirs" in pyproject.toml,
1616
# once the test folders are not installed we can derive the path from current file location: `pathlib.Path(__file__)`
1717
PROJECT_DIR = os.environ.get("PROJECT_DIR")
18-
assert PROJECT_DIR and os.path.exists(PROJECT_DIR)
18+
assert PROJECT_DIR and os.path.exists(PROJECT_DIR), f"Invalid PROJECT_DIR env variable: `{PROJECT_DIR}`."
1919

2020
OUTPUTS_DIR = pathlib.Path(os.getcwd()) / ".outputs"
2121

2222
NSYS_PATH = pathlib.Path(shutil.which("nsys"))
2323
NSYS_CONFIG_PATH = os.path.join(
24-
PROJECT_DIR, "backends", "nxp", "tests_models", "neutron-imxrt700.ini"
24+
PROJECT_DIR, "backends", "nxp", "tests", "neutron-imxrt700.ini"
2525
)
2626
NSYS_FIRMWARE_PATH = os.path.join(
2727
os.path.dirname(eiq_neutron_sdk.__file__),

backends/nxp/tests_models/config_importer.py renamed to backends/nxp/tests/config_importer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212

1313
logger.debug("Importing from executorch-integration")
1414
except ImportError:
15-
import executorch.backends.nxp.tests_models.config as test_config # noqa F401
15+
import executorch.backends.nxp.tests.config as test_config # noqa F401
1616

1717
logger.debug("Importing from executorch")
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import pathlib
99
import shutil
1010

11-
from executorch.backends.nxp.tests_models.outputs_dir_importer import outputs_dir
11+
from executorch.backends.nxp.tests.outputs_dir_importer import outputs_dir
1212

1313

1414
def pytest_addoption(parser):

backends/nxp/tests_models/dataset_creator.py renamed to backends/nxp/tests/dataset_creator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
import numpy as np
1515
import torch
1616
from executorch.backends.nxp.backend.ir.converter.conversion import translator
17+
from executorch.backends.nxp.tests.calibration_dataset import CalibrationDataset
1718
from executorch.backends.nxp.tests.executorch_pipeline import ModelInputSpec
18-
from executorch.backends.nxp.tests_models.calibration_dataset import CalibrationDataset
1919
from torch import Tensor
2020

2121

backends/nxp/tests/executorch_pipeline.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def to_model_input_spec(
108108
case list() if all(
109109
isinstance(input_shape, tuple) for input_shape in input_spec
110110
):
111-
return tuple([ModelInputSpec(spec) for spec in input_spec])
111+
return tuple(ModelInputSpec(spec) for spec in input_spec)
112112
case _:
113113
raise TypeError(f"Unsupported type {type(input_spec)}")
114114

@@ -302,7 +302,7 @@ def to_quantized_executorch_program(
302302

303303
def to_edge_program(
304304
model: nn.Module,
305-
input_spec: tuple[ModelInputSpec, ...] | tuple[int, ...] | list[tuple[int, ...]],
305+
input_spec: Iterable[ModelInputSpec] | tuple[int, ...] | list[tuple[int, ...]],
306306
) -> EdgeProgramManager:
307307
calibration_inputs = get_random_calibration_inputs(to_model_input_spec(input_spec))
308308

backends/nxp/tests_models/test_cifarnet.py renamed to backends/nxp/tests/generic_tests/test_cifarnet.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,19 @@
77

88
import pytest
99
import torch
10-
from executorch.backends.nxp.tests.executorch_pipeline import ModelInputSpec
11-
12-
from executorch.backends.nxp.tests_models.config_importer import test_config
13-
from executorch.backends.nxp.tests_models.dataset_creator import CopyDatasetCreator
1410

15-
from executorch.backends.nxp.tests_models.executors import (
16-
convert_run_compare,
17-
ReferenceModel,
18-
)
19-
from executorch.backends.nxp.tests_models.graph_verifier import (
11+
from executorch.backends.nxp.tests.config_importer import test_config
12+
from executorch.backends.nxp.tests.dataset_creator import CopyDatasetCreator
13+
from executorch.backends.nxp.tests.executorch_pipeline import ModelInputSpec
14+
from executorch.backends.nxp.tests.graph_verifier import (
2015
BaseGraphVerifier,
2116
NonDelegatedNode,
2217
)
23-
from executorch.backends.nxp.tests_models.model_output_comparator import (
18+
from executorch.backends.nxp.tests.model_output_comparator import (
2419
NumericalStatsOutputComparator,
2520
)
21+
22+
from executorch.backends.nxp.tests.nsys_testing import lower_run_compare, ReferenceModel
2623
from executorch.examples.nxp.experimental.cifar_net.cifar_net import (
2724
CifarNet,
2825
store_test_data,
@@ -64,7 +61,7 @@ def test_cifarnet(mocker, cifar_test_files, channels_last):
6461
comparator = NumericalStatsOutputComparator(
6562
max_mse_error=1.0e-3, is_classification_task=True
6663
)
67-
convert_run_compare(
64+
lower_run_compare(
6865
model,
6966
[input_spec],
7067
dataset_creator=CopyDatasetCreator(cifar_test_files),
@@ -94,7 +91,7 @@ def test_cifarnet_qat(mocker, cifar_test_files):
9491
comparator = NumericalStatsOutputComparator(
9592
max_mse_error=8e-2, is_classification_task=True
9693
)
97-
convert_run_compare(
94+
lower_run_compare(
9895
model,
9996
input_shape,
10097
dataset_creator=CopyDatasetCreator(cifar_test_files),
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)