Skip to content

Arm backend: Generate random conv2d test inputs lazily#19556

Open
zingo wants to merge 1 commit into
pytorch:mainfrom
zingo:Arm-backend-Generate-random-conv2d-test-inputs-lazily
Open

Arm backend: Generate random conv2d test inputs lazily#19556
zingo wants to merge 1 commit into
pytorch:mainfrom
zingo:Arm-backend-Generate-random-conv2d-test-inputs-lazily

Conversation

@zingo
Copy link
Copy Markdown
Collaborator

@zingo zingo commented May 13, 2026

Conv2d operator tests were creating random inputs at module import time. The Arm test seed is applied later by an autouse pytest fixture, so those tensors were not actually controlled by ARM_TEST_SEED.

That made tests nondeterministic across fresh pytest processes and could expose different quantization behavior from run to run. Generate the affected inputs lazily inside each test case so the existing seed fixture makes them reproducible and ARM_TEST_SEED=RANDOM can re-randomize the intended data.

cc @digantdesai @freddan80 @per @oscarandersson8218 @mansnils @Sebastian-Larsson @robell @rascani

Conv2d operator tests were creating random inputs at module import
time. The Arm test seed is applied later by an autouse pytest fixture,
so those tensors were not actually controlled by ARM_TEST_SEED.

That made tests nondeterministic across fresh pytest processes and could
expose different quantization behavior from run to run. Generate the
affected inputs lazily inside each test case so the existing seed
fixture makes them reproducible and ARM_TEST_SEED=RANDOM can rerandomize
the intended data.

Signed-off-by: Zingo Andersen <Zingo.Andersen@arm.com>
Change-Id: I48cf24e462000664d50f44fb9bdea9fa188784e3
Copilot AI review requested due to automatic review settings May 13, 2026 15:56
@zingo zingo requested a review from digantdesai as a code owner May 13, 2026 15:56
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented May 13, 2026

🔗 Helpful Links

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

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

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

❌ 2 New Failures, 4 Unrelated Failures

As of commit 043751e with merge base 2137894 (image):

NEW FAILURES - The following jobs have failed:

FLAKY - The following job failed but was likely due to flakiness present on trunk:

BROKEN TRUNK - The following jobs failed but was present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

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 May 13, 2026
@github-actions github-actions Bot added ciflow/trunk module: arm Issues related to arm backend labels May 13, 2026
@zingo zingo added the release notes: none Do not include this in the release notes label May 13, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 makes Arm backend conv2d operator tests deterministic by avoiding module-import-time randomness (e.g., Conv2d weight initialization) and instead constructing the Conv2d test modules lazily within each test case so the existing ARM_TEST_SEED fixture can control the RNG.

Changes:

  • Replaced module-level Conv2d(...) instances with factory functions that return a fresh Conv2d.
  • Updated test_data_FP / bf16 / fp16 test suites (and derived test_data_INT) to store these factories directly.
Comments suppressed due to low confidence (1)

backends/arm/test/ops/test_conv2d.py:163

  • Function name includes "pd1" but the Conv2d config uses padding=3. This mismatch makes failing-case IDs misleading; either update the name to reflect the actual padding or change padding to 1 if that’s what the test intends.
def conv2d_3x3_1x3x12x12_st1_pd1_replicate():
    return Conv2d(
        in_channels=3,
        out_channels=4,
        kernel_size=(3, 3),
        stride=1,
        padding=3,
        width=12,

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

Comment on lines +142 to +149
def conv2d_3x3_1x3x12x12_st1_pd1_reflect():
return Conv2d(
in_channels=3,
out_channels=4,
kernel_size=(3, 3),
stride=1,
padding=3,
width=12,
Comment on lines +339 to +340
width=8,
height=9,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. module: arm Issues related to arm backend release notes: none Do not include this in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants