Keep DS-CNN example inputs portable-safe - #21619
Merged
Merged
Conversation
Restore the shared DS-CNN example input to standard contiguous layout so the portable convolution kernel receives NCHW dim order. Convert and propagate four-dimensional inputs as channels-last inside the Cortex-M compiler, including singleton-channel tensors that satisfy both contiguity checks.\n\nThis ports the release/1.4 fix from #21563 to main.\n\nAuthored with Codex assistance.
Contributor
digantdesai
reviewed
Aug 6, 2026
| return ( | ||
| (torch.rand(1, 1, 49, 10) * 2 - 1).to(memory_format=torch.channels_last), | ||
| ) | ||
| return (torch.rand(1, 1, 49, 10) * 2 - 1,) |
Contributor
There was a problem hiding this comment.
this is based on the implicit, always-do-to-nhwc call for cortex-m, I guess? should we add a test for that?
digantdesai
approved these changes
Aug 6, 2026
Contributor
|
merged to main. two things are still open and would be lost here, so noting them:
the ds_cnn portable job runs from the nightly workflow, not from pull or trunk, so the next scheduled run is the first place this shows up as green. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PR #21485 moved the shared DS-CNN example input to channels-last to satisfy the Cortex-M backend. That regressed the portable model test because portable convolution expects the input's standard NCHW dim order.
DS-CNN's input shape is
(1, 1, 49, 10). With a singleton channel, its original NCHW tensor reports both contiguous and channels-last contiguous even though its strides remain(490, 490, 10, 1). The Cortex-M compiler's conditional conversion therefore did not materialize channels-last strides.This ports the release/1.4 fix from #21563 to main.
Test plan
python3 -m py_compile examples/models/mlperf_tiny/ds_cnn.py backends/arm/scripts/aot_arm_compiler.pygit diff --check(1, 1, 49, 10)(490, 490, 10, 1)(490, 1, 10, 1)Authored with Codex.
cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell @rascani