Expand Dropout test coverage and migrate to absltest#5281
Expand Dropout test coverage and migrate to absltest#5281us wants to merge 1 commit intogoogle:mainfrom
Conversation
Summary of ChangesHello @us, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the robustness and maintainability of the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request is a great improvement. It successfully migrates the tests for nnx.Dropout from pytest to absltest and significantly expands the test coverage with many valuable new test cases, including edge cases and statistical correctness checks. The changes are well-structured and align with the project's testing standards. I have one minor suggestion to improve the readability of a newly added test.
4d175e9 to
d8db01b
Compare
d8db01b to
24d9531
Compare
What does this PR do?
Expands test coverage for
nnx.Dropoutintests/nnx/nn/stochastic_test.pyand migrates the test file from plainpytestto the project-standardabsltestframework.Changes:
pytestclasses toabsltest/parameterized.TestCaseassertwithself.assertEqual/self.assertIsNotNonepytest.raiseswithself.assertRaises/self.assertRaisesRegexif __name__ == '__main__': absltest.main()entry pointNew tests (4 → 24):
test_rate_zero/test_rate_one— edge case rate limitstest_rate_one_gradient_not_nan— gradient safety at rate=1.0test_deterministic_passthrough— deterministic mode returns input unchangedtest_dtypes— float32, float16, bfloat16 dtype preservationtest_broadcast_dims— 7 parameterized cases ported from Linen reference teststest_rate_stats— statistical correctness across rates 0.1–0.9test_rngs_as_jax_array— passing rawjax.Arraykey as rngstest_rngs_as_nnx_rngs_in_call— passingnnx.Rngsdirectly to__call__test_custom_rng_collection— non-defaultrng_collectionparametertest_invalid_rngs_type_constructor/test_invalid_rngs_type_call— TypeError for invalid rngs typesAll code paths in
flax/nnx/nn/stochastic.pyare now covered.Checklist