tabensemb.model.AbstractNN.set_requires_grad#
method
- AbstractNN.set_requires_grad(model: Module, requires_grad: bool | None = None, state=None)[source]#
Set or reset requires_grad states of a
nn.Module.- Parameters:
- model
A
nn.Modulemodel.- requires_grad
The requires_grad state for all parameters in the model.
- state
The recorded state when calling this method with the argument
required_gradgiven.
- Returns:
- list
The recorded state that can be used as the argument “state” to restore requires_grad states of the same model. Returned when the argument
requires_gradis given.