netket.vqs.freeze_parameters

netket.vqs.freeze_parameters#

netket.vqs.freeze_parameters(vstate, is_frozen)[source]#

Freeze a subset of model parameters in a variational state.

Thin shim around netket.nn.freeze_parameters(): extracts the model and variables from vstate, freezes the matching parameters, and returns a new variational state of the same type. Frozen parameters are moved from vstate.parameters into vstate.model_state so they are automatically excluded from gradient computation and optimizer updates.

Parameters:
Return type:

VariationalState

Returns:

A new variational state of the same type as vstate.

Example:

import netket as nk

frozen_vstate = nk.vqs.freeze_parameters(
    vstate, lambda path, _: "kernel" in path
)