bijx.Const¶
- class bijx.Const[source]¶
Bases:
Variable
Mark a variable as constant during training.
This variable type explicitly indicates that a parameter should remain fixed during optimization. Useful for freezing parts of models or storing hyperparameters that should not be updated.
Can be used with
FrozenFilter
to selectively freeze parameters during gradient-based optimization.Example
>>> bijection = SomeBijection() >>> bijection.scale = Const(1.0) # Fix scale parameter >>> # standard optimizers will not apply gradients to scale
- __init__(value, *, use_ref=None, **metadata)¶
- Parameters:
value (A | VariableMetadata[A])
use_ref (bool | None)
metadata (Any)
Methods
add_axis
(axis_index, axis_name)copy_from
(other)create_value
(value)from_metadata
(value, attributes)get_metadata
([name])Get metadata for the Variable.
remove_axis
(axis_index, axis_name)replace
([value])set_metadata
(*args, **kwargs)Set metadata for the Variable.
to_state
()update_from_state
(variable_state)Attributes
has_ref
type
The type of the variable.
value
- raw_value: A¶