You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’d like to improve the NNX API reference docs (not Linen). While working on a smaller docs issue (#5107), I noticed a few recurring problems across the NNX API reference: incomplete indexing/toctrees, inconsistent Sphinx cross-references vs code formatting, and missing/unclear docstrings for user-facing symbols. Some pages also look copied from older docs and don’t match the current NNX surface.
Example:
flax.nnx.unflatten in the graph section has a kwarg outer_index_outer_ref=None, but its docstring refers to index_ref_cache (which doesn’t exist).
To keep review manageable, I’ll do this as a series of small PRs, going section by section in the API Reference page. To keep the scope manageable I'll focus on docs + docstrings only (no behavioral changes).
Is it ok if I send small PRs starting with flax.nnx.graph?
Hi @ibbyml, thanks for pointing that out. Yes, keeping the docs updated during the development can be a bit complex. If you can pointing out all these inconsistencies and send small fixes, it would be awesome.
The team is also working on how to improve the merging process on the approved PRs, but meanwhile having the fixes on GitHub would be very helpful!
Hi @ibbyml and @vfdev-5, this sounds like a great initiative! To help parallelize the effort, I can take ownership of auditing the flax.nnx.nn module (Linear, Conv, Attention, etc.).
I'll check for the same inconsistencies (missing args, broken cross-refs, and outdated Linen-style docstrings) and submit them as separate, small PRs. Does that sound good?
I'd like to take the filterlib section. The filter classes (WithTag, PathContains, OfType, Any, All, Not, Everything, Nothing) are exported but currently render with no docstrings in the API reference, I'll add short docstrings for each based on the descriptions in the Filters guide.
Hi @vfdev-5 , I'd like to take the flax.nnx.training section (Metrics, Optimizer, EMA) as part of this docs audit. A few concrete inconsistencies I've already spotted there:
EMA.apply_to() isn't rendered in the API reference — training/ema.rst only lists __init__, update in :members:, even though apply_to() is public and is used in EMA's own docstring examples.
Accuracy renders inconsistently with the other metrics: training/metrics.rst lists :members: update for it, while Metric/Average/Welford/MultiMetric all list __init__, reset, update, compute. As a result Accuracy's constructor doc (the threshold arg) isn't shown.
Statistics (returned by Welford.compute(), and shown in its rendered example) has no docstring or reference entry.
I'll keep it docs + docstrings only, no behavioral changes, and send it as a small PR (or a couple) scoped to this section. Sound good?
Hi @vfdev-5, following up on my training section PR (#5544) — I'd like to also take the variables, rnglib, and helpers sections. Concrete issues found:
with_metadata is listed in variables.rst via autofunction but has no docstring, so it renders as a bare signature.
RngStream has no docstring of its own — the API reference shows the generic inherited Pytree docstring ("Base class for all NNX objects."), which is misleading.
List and Dict (in helpers) both have a "contained a mixed set" → "containing a mixed set" typo.
Docs + docstrings only, no behavioral changes, small PR same as before.
Activity
vfdev-5 commentedon Jan 5, 2026
Hi @ibbyml, thanks for pointing that out. Yes, keeping the docs updated during the development can be a bit complex. If you can pointing out all these inconsistencies and send small fixes, it would be awesome.
The team is also working on how to improve the merging process on the approved PRs, but meanwhile having the fixes on GitHub would be very helpful!
ayushkumrdev commentedon Jan 6, 2026
Hi @ibbyml and @vfdev-5, this sounds like a great initiative! To help parallelize the effort, I can take ownership of auditing the flax.nnx.nn module (Linear, Conv, Attention, etc.).
I'll check for the same inconsistencies (missing args, broken cross-refs, and outdated Linen-style docstrings) and submit them as separate, small PRs. Does that sound good?
fix stale docstring arg name and expose missing graph context APIs
santihdzs commentedon May 29, 2026
I'd like to take the filterlib section. The filter classes (WithTag, PathContains, OfType, Any, All, Not, Everything, Nothing) are exported but currently render with no docstrings in the API reference, I'll add short docstrings for each based on the descriptions in the Filters guide.
greekera1000 commentedon Aug 4, 2026
Hi @vfdev-5 , I'd like to take the
flax.nnx.trainingsection (Metrics, Optimizer, EMA) as part of this docs audit. A few concrete inconsistencies I've already spotted there:EMA.apply_to()isn't rendered in the API reference —training/ema.rstonly lists__init__, updatein:members:, even thoughapply_to()is public and is used in EMA's own docstring examples.Accuracyrenders inconsistently with the other metrics:training/metrics.rstlists:members: updatefor it, whileMetric/Average/Welford/MultiMetricall list__init__, reset, update, compute. As a resultAccuracy's constructor doc (thethresholdarg) isn't shown.Statistics(returned byWelford.compute(), and shown in its rendered example) has no docstring or reference entry.I'll keep it docs + docstrings only, no behavioral changes, and send it as a small PR (or a couple) scoped to this section. Sound good?
greekera1000 commentedon Aug 5, 2026
Hi @vfdev-5, following up on my training section PR (#5544) — I'd like to also take the variables, rnglib, and helpers sections. Concrete issues found:
with_metadata is listed in variables.rst via autofunction but has no docstring, so it renders as a bare signature.
RngStream has no docstring of its own — the API reference shows the generic inherited Pytree docstring ("Base class for all NNX objects."), which is misleading.
List and Dict (in helpers) both have a "contained a mixed set" → "containing a mixed set" typo.
Docs + docstrings only, no behavioral changes, small PR same as before.