bijx.Const¶
- class bijx.Const[source]¶
Bases:
VariableMark 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
FrozenFilterto 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, *, hijax=None, ref=None, mutable=True, eager_sharding=None, **metadata)¶
- Parameters:
value (A | VariableMetadata[A])
hijax (bool | None)
ref (bool | None)
mutable (bool)
eager_sharding (bool | None)
metadata (Any)
Methods
add_axis(axis_index, axis_name)copy_from(other)create_value(value)del_metadata(name)Delete a metadata entry for the Variable.
from_metadata(value, attributes)get_metadata([name, default, exclude_required])Get metadata for the Variable.
get_raw_value()get_value(*[, index])has_metadata(name)Check if the Variable has a metadata entry for the given name.
remove_axis(axis_index, axis_name)replace([value, _copy_ref])set_metadata(*args, **kwargs)Set metadata for the Variable.
set_raw_value(value, *[, _unsafe_bypass_check])set_value(value, *[, index])to_state([value, _copy_ref])update_from_state(variable_state)Attributes
hijaxmutableraw_valuerefrequired_metadatashapesharding_namestypeThe type of the variable.
valuevar_type