Skip to content

NXP backend: added and refactored tests for converting unsqueeze/squeeze to view_copy#20810

Open
novak-vaclav wants to merge 1 commit into
pytorch:mainfrom
nxp-upstream:feature/add-convert-squeeze-unsqueeze-to-view-tests
Open

NXP backend: added and refactored tests for converting unsqueeze/squeeze to view_copy#20810
novak-vaclav wants to merge 1 commit into
pytorch:mainfrom
nxp-upstream:feature/add-convert-squeeze-unsqueeze-to-view-tests

Conversation

@novak-vaclav

Copy link
Copy Markdown
Collaborator

Summary

Added and refactored tests for converting unsqueeze/squeeze to view_copy.

Test plan

tests can be manually run using pytest -c /dev/null backends/nxp/tests/

cc @robert-kalmar @JakeStevens @digantdesai @rascani @MartinPavella

@novak-vaclav novak-vaclav added the module: nxp Issues related to NXP Neutron NPU delegation and code under backends/nxp/ label Jul 9, 2026
Copilot AI review requested due to automatic review settings July 9, 2026 18:17
@novak-vaclav novak-vaclav added the release notes: nxp Changes to the NXP Neutron backend delegate label Jul 9, 2026
@pytorch-bot

pytorch-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/20810

Note: Links to docs will display an error until the docs builds have been completed.

⏳ No Failures, 3 Pending

As of commit 3a3b701 with merge base 910c45c (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 9, 2026
@linux-foundation-easycla

Copy link
Copy Markdown

CLA Not Signed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the NXP backend test coverage for the edge pass that converts unsqueeze/squeeze nodes into view_copy, moving the tests to the newer lower_run_compare + DetailedGraphVerifier harness and adding QAT variants.

Changes:

  • Replaced the prior full-pipeline + convert_run_compare/graph-op presence checks with lower_run_compare and delegation-count verification via DetailedGraphVerifier.
  • Consolidated repeated test logic into a shared helper and expanded parameterization for squeeze cases.
  • Added dedicated QAT test cases for both unsqueezeview_copy and squeezeview_copy.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +26 to +48
@staticmethod
def assert_converted_to_view(model, input_shape, mocker, request, use_qat=False):
graph_verifier = DetailedGraphVerifier(
mocker,
expected_delegated_ops={ViewCopy: 1, AddTensor: 1},
expected_non_delegated_ops={},
)
dataset = RandomDatasetCreator(low=-1.0, high=1.0)

# Use quantized dataset and allow single bit error.
remove_quant_io_ops = True
comparator = AllCloseOutputComparator(atol=1)

lower_run_compare(
model,
input_shape,
graph_verifier,
request,
dataset,
comparator,
use_qat=use_qat,
remove_quant_io_ops=remove_quant_io_ops,
)
Comment on lines +12 to +15
from executorch.backends.nxp.tests.nsys_testing import (
AllCloseOutputComparator,
lower_run_compare,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. module: nxp Issues related to NXP Neutron NPU delegation and code under backends/nxp/ release notes: nxp Changes to the NXP Neutron backend delegate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants