MCPcopy
hub / github.com/Vchitect/Latte / requires_grad

Function requires_grad

utils.py:202–207  ·  view source on GitHub ↗

Set requires_grad flag for all parameters in a model.

(model, flag=True)

Source from the content-addressed store, hash-verified

200 ema_params[name].mul_(decay).add_(param.data, alpha=1 - decay)
201
202def requires_grad(model, flag=True):
203 """
204 Set requires_grad flag for all parameters in a model.
205 """
206 for p in model.parameters():
207 p.requires_grad = flag
208
209def cleanup():
210 """

Callers 4

mainFunction · 0.90
mainFunction · 0.90
__init__Method · 0.90
__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected