Ignored Module tests: provide required input tensor#19028
Ignored Module tests: provide required input tensor#19028psiddh wants to merge 2 commits intopytorch:mainfrom
Conversation
All 4 tests failed because they called forward() with zero arguments on mobilenet_v2 which expects a [1,3,224,224] float input. This was a test bug, not a runtime bug. Add a dummyInput() helper that creates a Tensor.ones with the correct shape, and remove all @ignore annotations. This commit was authored with the help of Claude.
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/19028
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New Failure, 4 Unrelated FailuresAs of commit 8fe6bec with merge base 66e4656 ( NEW FAILURE - The following job has failed:
BROKEN TRUNK - The following jobs failed but were 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. |
This PR needs a
|
There was a problem hiding this comment.
Pull request overview
Fixes previously ignored Android instrumentation tests for Module by providing the required MobilenetV2 input tensor so forward()/execute() are invoked with valid arguments.
Changes:
- Remove
@Ignoreannotations from four instrumentation tests. - Add a
dummyInput()helper that constructs a[1, 3, 224, 224]float tensor and pass it intoforward()/execute(). - Update the multi-threaded forward test to use the dummy input.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| val results = module.forward(EValue.from(dummyInput())) | ||
| Assert.assertTrue(results[0].isTensor) |
There was a problem hiding this comment.
In the multi-thread test each worker allocates a new 1x3x224x224 float tensor via dummyInput(). With 100 threads this can create significant short-lived allocations (~60MB+), which can make the instrumentation test flaky on memory-constrained devices. Consider pre-creating a single Tensor (or even EValue) and reusing it across threads/tests to avoid repeated allocations.
|
@claude review this PR |
|
Claude finished @JacobSzwejbka's task in 52s —— View job Review of PR #19028
The fix is correct. The 4 tests were Minor items:
Verdict: This is a clean, minimal fix. LGTM. |
|
@claude explain the ci failures on this PR |
|
Claude finished @JacobSzwejbka's task in 1m 47s —— View job
CI Failure AnalysisThis PR only modifies a single file ( 1. New Failure:
|
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| val module = Module.load(getTestFilePath(TEST_FILE_NAME)) | ||
|
|
||
| val results = module.forward() | ||
| val results = module.forward(EValue.from(dummyInput())) | ||
| Assert.assertTrue(results[0].isTensor) |
There was a problem hiding this comment.
This test now runs forward() successfully, but the Module is never destroyed. Since Module owns native resources and GC timing is non-deterministic, this can cause memory retention across instrumentation tests (especially now that these tests are no longer @ignore). Consider wrapping the test body in try/finally and calling module.destroy() in the finally block.
| val module = Module.load(getTestFilePath(TEST_FILE_NAME)) | ||
|
|
||
| module.loadMethod(FORWARD_METHOD) | ||
|
|
||
| val results = module.forward() | ||
| val results = module.forward(EValue.from(dummyInput())) | ||
| Assert.assertTrue(results[0].isTensor) |
There was a problem hiding this comment.
The Module instance created in this test is not destroyed. Because Module wraps native state and tests are now enabled, relying on GC can retain native memory longer than intended and introduce flakes. Consider calling module.destroy() (ideally via try/finally) after the assertion.
| val module = Module.load(getTestFilePath(TEST_FILE_NAME)) | ||
|
|
||
| val results = module.execute(FORWARD_METHOD) | ||
| val results = module.execute(FORWARD_METHOD, EValue.from(dummyInput())) | ||
| Assert.assertTrue(results[0].isTensor) |
There was a problem hiding this comment.
The Module created here is never destroyed. Since Module owns native resources, consider cleaning it up with module.destroy() (e.g., in a finally block) to avoid retaining native memory across the instrumentation test run.
| latch.await(5000, TimeUnit.MILLISECONDS) | ||
| val results = module.forward() | ||
| val results = module.forward(EValue.from(dummyInput())) | ||
| Assert.assertTrue(results[0].isTensor) |
There was a problem hiding this comment.
This test loads a Module and runs it across many threads but never calls module.destroy() after the threads finish. Given the native resources involved (and now that the test is enabled), add a destroy in teardown/try-finally after joins to reduce memory retention and potential test flakiness.
All 4 tests failed because they called forward() with zero arguments on mobilenet_v2 which expects a [1,3,224,224] float input. This was a test bug, not a runtime bug. Add a dummyInput() helper that creates a Tensor.ones with the correct shape, and remove all @ignore annotations.