Skip to content

Improve EMA documentation clarity and stability test coverage#888

Open
savirpatil wants to merge 3 commits into
google-deepmind:mainfrom
savirpatil:fix-doc-example
Open

Improve EMA documentation clarity and stability test coverage#888
savirpatil wants to merge 3 commits into
google-deepmind:mainfrom
savirpatil:fix-doc-example

Conversation

@savirpatil

@savirpatil savirpatil commented May 20, 2026

Copy link
Copy Markdown

This PR improves documentation clarity and test coverage for ExponentialMovingAverage in dm-haiku.

Changes include:

  • Updated a doctest example in moving_averages.py for clearer and more explicit usage

    • adds explicit imports for clarity
    • introduces a named RNG variable for readability
    • preserves the existing seed value
    • improves example completeness and readability
  • Added a dtype stability test for repeated EMA updates

    • ensures float32 inputs remain float32 across repeated applications
  • Added a numerical stability test for repeated constant-input EMA updates

    • verifies outputs remain finite during repeated updates
    • validates stable bounded behavior under iterative application

No functional changes to library behavior are introduced.

@savirpatil savirpatil changed the title Fix doctest example in moving_averages docstring Improve EMA documentation clarity and add dtype stability test May 27, 2026
@savirpatil savirpatil changed the title Improve EMA documentation clarity and add dtype stability test Improve EMA documentation clarity and stability test coverage Jun 5, 2026
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