Skip to content
Merged
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
10 changes: 10 additions & 0 deletions jax/_src/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@ def reduce(function: Callable[[T, Any], T],
>>> jax.tree.reduce(operator.add, [1, (2, 3), [4, 5, 6]])
21

Notes:
**Tip**: You can exclude leaves from the reduction by first mapping them to
``None`` using :func:`jax.tree.map`. This causes them to not be counted as
leaves after that.

See Also:
- :func:`jax.tree.reduce_associative`
- :func:`jax.tree.leaves`
Expand Down Expand Up @@ -230,6 +235,11 @@ def reduce_associative(
>>> jax.tree.reduce_associative(operator.add, [1, (2, 3), [4, 5, 6]])
21

Notes:
**Tip**: You can exclude leaves from the reduction by first mapping them to
``None`` using :func:`jax.tree.map`. This causes them to not be counted as
leaves after that.

See Also:
- :func:`jax.tree.reduce`
"""
Expand Down
Loading