is_pytree_node_field

is_pytree_node_field#

penzai.core.struct.is_pytree_node_field(field: dataclasses.Field[Any]) bool[source]#

Returns True if this field is treated as a PyTree child node by Struct.

Fields are treated as PyTree nodes by default unless they contain a metadata entry with key “pytree_node” and value False.

Parameters:

field – Field to check.

Returns:

True if this field should be treated as a PyTree node.