Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update NNX Module eval docs in module.py #4446

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions flax/nnx/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,12 +358,13 @@ def train(self, **attributes):
)

def eval(self, **attributes):
"""Sets the Module to evaluation mode.
"""Sets the :class:`flax.nnx.Module` to evaluation mode.

``eval`` uses ``set_attributes`` to recursively set attributes ``deterministic=True``
and ``use_running_average=True`` of all nested Modules that have these attributes.
Its primarily used to control the runtime behavior of the ``Dropout`` and ``BatchNorm``
Modules.
``nnx.Module.eval`` uses :func:`flax.nnx.Module.set_attributes` to recursively set
attributes ``deterministic=True`` and ``use_running_average=True`` of all nested
``nnx.Module``'s that have these attributes.
It is primarily used to control the runtime behavior of the :class:`flax.nnx.Dropout`
and :class:`flax.nnx.BatchNorm` ``nnx.Module``'s.

Example::

Expand All @@ -383,7 +384,7 @@ def eval(self, **attributes):
(True, True)

Args:
**attributes: additional attributes passed to ``set_attributes``.
**attributes: Additional attributes passed to ``set_attributes``.
"""
return self.set_attributes(
deterministic=True,
Expand Down
Loading