Commit 3253a28
authored
Reseed the Cortex-M test RNG before each test module is imported (pytorch#21794)
### Summary
Model tests that build calibration data or example inputs at module
scope draw from the global RNG during pytest collection, not during the
test. Seeding only in pytest_configure therefore left those draws
dependent on how many other modules pytest happened to import first, so
a test's quantization could change purely because a file was added
elsewhere in the directory.
Adding a test_silero_vad import ahead of test_mobilenet_v2 moves mv2's
first calibration sample sum from -310.9496 to -42.2950; the reverse
order moves silero's input sum from 15.9070 to 7.8727. Reseeding in
pytest_collectstart makes both stable, and leaves the existing per-test
autouse fixture untouched.
The TEST_RUNTIME_IS_NOT_OSS guard mirrors the one already in
pytest_configure, which in turn follows backends/arm/test/conftest.py.
Authored with assistance from Claude Code.1 parent 66967ef commit 3253a28
1 file changed
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
67 | 78 | | |
68 | 79 | | |
69 | 80 | | |
| |||
0 commit comments