| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Replace the three per-scheduler *_preserves_tensor_lr tests with one parametrized contract test driven by TENSOR_LR_CONTRACTS, plus a coverage assertion that fails collection when a scheduler in VALID_LR_SCHEDULES has no contract row. A new scheduler that bypasses update_lr() in its constructor will now regress the suite without needing a hand-written test. Signed-off-by: Guokai Ma <guokai.ma@intel.com>
There was a problem hiding this comment.
Here are some automated review suggestions for this pull request.
Reviewed commit: 07499c2a24
ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Sorry, something went wrong.
| # scalar, so the caller-held reference keeps its identity, shape and dtype. | ||
| # Add a row when a new scheduler is registered; the coverage test below fails | ||
| # collection if any scheduler is missing. | ||
| TENSOR_LR_CONTRACTS = [ |
There was a problem hiding this comment.
Add the missing Signed-off-by trailer
This non-merge commit has a single parent and its commit message ends without a Signed-off-by: trailer, but the repository requires every non-merge commit to be signed off. Without that trailer, DCO/CI can reject the change even though the test consolidation itself is local; please recreate or amend the commit with git commit --signoff using the configured name/email.
AGENTS.md reference: AGENTS.md:L8-L8
Useful? React with 👍 / 👎.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
What
Replaces the three per-scheduler *_preserves_tensor_lr tests (WarmupLR, WarmupCosineLR, OneCycle) with a single parametrized contract test driven by a TENSOR_LR_CONTRACTS table, plus a registry-coverage assertion that fails collection when a scheduler listed in VALID_LR_SCHEDULES has no contract row.
Why
#8205 recently fixed OneCycle._initialize_lr bypassing update_lr(), which silently replaced a caller-supplied tensor LR with a Python scalar on construction. WarmupLR and WarmupCosineLR had the same class of bug fixed in #8202. Each fix was caught only because someone happened to write a hand-rolled regression test for that specific scheduler.
This PR turns that pattern into a contract: every scheduler in VALID_LR_SCHEDULES is pinned by one table row asserting tensor identity / shape / dtype at init and after step(1). Two failure modes are covered:
Both guards were verified empirically against this branch:
Test footprint
CPU-only, no GPU/distributed runner required:
pre-commit run --files tests/unit/runtime/test_lr_schedulers.py passes (yapf, flake8, check-torchdist, check-license, codespell).
Authored by an AI coding agent (opencode, model: glm-5.2) under interactive human direction and review.