pz
: Penzai’s alias namespace#
Structs#
Most objects in Penzai models are subclasses of pz.Struct
and
decorated with pz.pytree_dataclass
, which makes them into frozen Python
dataclasses that are also JAX PyTrees.
|
Alias of |
|
Alias of |
PyTree Manipulation#
Penzai provides a number of utilities to make targeted modifications to PyTrees. Since Penzai models are PyTrees, you can use them to insert new layers into models, or modify the configuration of existing layers.
|
Alias of |
|
Alias of |
|
Alias of |
|
Alias of |
|
Alias of |
Named Axes#
pz.nx
is an alias for penzai.core.named_axes
, which contains
Penzai’s named axis system. Some commonly-used attributes on pz.nx
:
|
Alias of |
|
Alias of |
|
Alias of |
See penzai.core.named_axes
for documentation of all of the methods and
classes accessible through the pz.nx
alias.
To simplify slicing named axes, Penzai also provides a helper object:
|
Builds a slice when sliced (e.g. |
Parameters and State Variables#
Penzai handles mutable state by embedding stateful parameters and variables into JAX pytrees. It provides a number of utilities to manipulate these stateful components and support passing them across JAX transformation boundaries.
|
Alias of |
|
Alias of |
|
Alias of |
|
Alias of |
|
Alias of |
|
Alias of |
|
Alias of |
|
Alias of |
|
Alias of |
|
Alias of |
|
Alias of |
|
Alias of |
|
Alias of |
|
Alias of |
|
Alias of |
|
Alias of |
|
Alias of |
|
Alias of |
|
Alias of |
|
Alias of |
|
Alias of |
|
Alias of |
|
Alias of |
|
Alias of |
Neural Networks#
pz.nn
is an alias namespace for Penzai’s declarative neural network
system, which uses a combinator-based design to expose all of your model’s
operations as nodes in your model PyTree. pz.nn
re-exports layers from
submodules of penzai.nn
in a single convenient namespace.
See the documentation for pz.nn
to view all of the
methods and classes accessible through this alias namespace.
Shape-Checking#
pz.chk
is an alias for penzai.core.shapecheck
, which contains
utilities for checking the shapes of PyTrees of positional and named arrays.
Some commonly-used attributes on pz.chk
:
|
Alias of |
|
Alias of |
|
Alias of |
See penzai.core.shapecheck
for documentation of all of the methods and
classes accessible through the pz.chk
alias.
Dataclass and Struct Utilities#
|
Alias of |
|
Alias of |
|
Alias of |
|
Alias of |
Rendering and Global Configuration Management#
These utilities are available in the pz
namespace for backwards
compatibility. However, they have been moved to the separate Treescope
pretty-printing package. See the
Treescope documentation
for more information.
Alias of |
|
|
Alias of |
|
Alias of |
|
Alias of |
|
Alias of |
|
Alias of |
|
Alias of |