qml.pytrees.register_pytree¶
- register_pytree(pytree_type, flatten_fn, unflatten_fn, *, namespace='qml')[source]¶
Register a type with all available pytree backends.
Current backends are jax and pennylane.
- Parameters
pytree_type (type) – the type to register, such as
qml.RX
flatten_fn (Callable) – a function that splits an object into trainable leaves and hashable metadata.
unflatten_fn (Callable) – a function that reconstructs an object from its leaves and metadata.
namespace (str) – A prefix for the name under which this type will be registered.
- Returns
None
- Side Effects:
pytree
type becomes registered with available backends.
See also
code/api/pennylane.pytrees.register_pytree
Download Python script
Download Notebook
View on GitHub