parameters#
Parameters and state variables in Penzai neural networks.
Parameters in Penzai models are allowed to be any object that has a value
attribute, as described in the ParameterLike
protocol. This makes it possible
to wrap parameters or apply preprocessing logic when values are retrieved.
Usually, however, Penzai parameters are instances of Parameter
, which is a
subclass of Variable
. This allows them to be easily shared and updated in
place.
By convention, neural network initializers take an argument init_base_rng
,
which is a JAX PRNG key that is shared across the full model. They then
initialize their parameters by combining the init_base_rng
with the unique
string name of each parameter.
Classes
Protocol for a parameter-like object. |
Functions
|
Asserts that the given model has no ParameterSlot subtrees. |
|
Derives a PRNG key for a parameter from a base key and a name. |
|
Makes a parameter variable (or slot) with a given name and initializer. |