Skip to content

Fix masking in label smoothing - #1760

Open
tandede wants to merge 1 commit into
google-deepmind:mainfrom
tandede:fix/masked-label-smoothing
Open

Fix masking in label smoothing#1760
tandede wants to merge 1 commit into
google-deepmind:mainfrom
tandede:fix/masked-label-smoothing

Conversation

@tandede

@tandede tandede commented Aug 20, 2026

Copy link
Copy Markdown

Summary

  • distribute label-smoothing mass only across categories selected by where
  • keep fully masked groups finite by using a nonzero normalization denominator
  • add JIT regression coverage for partial and fully masked category sets

Test plan

  • pre-commit run --files optax/losses/_smoothing.py optax/losses/_smoothing_test.py
  • python -m flake8 on the changed files
  • python -m pylint on the changed files (10.00/10)
  • pytest -q optax/losses/_smoothing_test.py (3 passed)
  • pytest -q -n 4 optax (2617 passed, 78 skipped, 3382 subtests passed)

@tandede
tandede marked this pull request as ready for review August 20, 2026 06:33
@tandede

tandede commented Aug 30, 2026

Copy link
Copy Markdown
Author

Hi maintainers, I’m following up on this PR in case it was missed. The CLA, security scans, linting, type checks, doctests, and Python/JAX test matrix have all passed. The label-smoothing masking fix is ready for review, and I’d be happy to address any feedback. Thank you!

@tandede
tandede force-pushed the fix/masked-label-smoothing branch from d29ff94 to 9ae27d9 Compare August 31, 2026 02:56
@tandede

tandede commented Aug 31, 2026

Copy link
Copy Markdown
Author

I rebased this branch onto the latest main and resolved the conflict. The conflicting Pyrefly fixes had already landed upstream, so I dropped the duplicate helper commit and retained only the label-smoothing fix and its regression test.

I reran the full Optax test suite locally: 2,617 passed, 78 skipped, with 3,382 subtests passed. Pre-commit, Ruff, Pyrefly, and git diff --check also passed. The current head is 9ae27d9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant