SharedParameterLookup#
- class penzai.nn.parameters.SharedParameterLookup[source]#
-
A marker identifying a shared parameter.
A
SharedParameterLookupacts like a parameter, but does not actually hold its value. Instead, it retrieves its parameter using aSideInputEffect, and expects the value of the parameter to be provided by some external handler, as configured byattach_shared_parameters.- Variables:
ref (side_input.SideInputEffect[ParameterLike[T]]) – The
SideInputEffectthat provides the value for this parameter.value_structure (shapecheck.StructureAnnotation) – The structure of the value that will be substituted here.
Methods
__init__(ref, value_structure)treescope_color()Attributes
Value accessor for compatibility with
ParameterLike.refvalue_structureInherited Methods
(expand to view inherited methods)
attributes_dict()Constructs a dictionary with all of the fields in the class.
from_attributes(**field_values)Directly instantiates a struct given all of its fields.
key_for_field(field_name)Generates a JAX PyTree key for a given field name.
select()Wraps this struct in a selection, enabling functional-style mutations.
tree_flatten()Flattens this tree node.
tree_flatten_with_keys()Flattens this tree node with keys.
tree_unflatten(aux_data, children)Unflattens this tree node.
- property value#
Value accessor for compatibility with
ParameterLike.- Raises:
MissingSharedParameterError – Since
SharedParameterLookupdoes not have a value until given one by anattach_shared_parameterswrapper, retrieving their value always raises an error.