qml.pytrees

Warning

Unless you are a PennyLane or plugin developer, you likely do not need to use these functions.

An internal module for working with pytrees.

Functions

flatten(obj[, is_leaf])

Flattens a pytree into leaves and a structure.

is_pytree(type_)

Returns True if type_ is a registered Pytree.

register_pytree(pytree_type, flatten_fn, ...)

Register a type with all available pytree backends.

unflatten(data, structure)

Bind data to a structure to reconstruct a pytree object.

Classes

PyTreeStructure([type_, metadata, children])

A pytree data structure, holding the type, metadata, and child pytree structures.

Variables

leaf

A pytree data structure, holding the type, metadata, and child pytree structures.