Skip to content

Commit d88be19

Browse files
author
Orbax Authors
committed
Improve LeafHandler class docstring
PiperOrigin-RevId: 884832140
1 parent 0518e11 commit d88be19

File tree

1 file changed

+14
-1
lines changed
  • checkpoint/orbax/checkpoint/experimental/v1/_src/serialization

1 file changed

+14
-1
lines changed

checkpoint/orbax/checkpoint/experimental/v1/_src/serialization/types.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,20 @@ async def deserialize(
267267

268268

269269
class LeafHandler(Protocol[Leaf, AbstractLeaf]):
270-
"""Interface for reading and writing a PyTree leaf."""
270+
"""Interface for reading and writing a PyTree leaf.
271+
272+
This protocol defines the essential asynchronous operations for saving
273+
(`serialize`), loading (`deserialize`), and inspecting (`metadata`) individual
274+
leaf nodes within a PyTree. It is essentially a blueprint that allows for
275+
implementing support for serialization of custom leaf objects.
276+
277+
Example:
278+
This class is not intended to be used independently. It must be subclassed
279+
to implement custom LeafHandlers (class) for specific leaf types.
280+
281+
See: `Custom Leaf Handler <
282+
https://orbax.readthedocs.io/en/latest/guides/checkpoint/v1/customization.html#custom-leaf-handler>`_
283+
"""
271284

272285
async def serialize(
273286
self,

0 commit comments

Comments
 (0)