MCPcopy Create free account
hub / github.com/TorchSSL/TorchSSL / wd_loss

Function wd_loss

train_utils.py:188–195  ·  view source on GitHub ↗
(net)

Source from the content-addressed store, hash-verified

186
187
188def wd_loss(net):
189 loss = 0
190 for name, param in net.named_parameters():
191 if ('bn' in name or 'bias' in name):
192 continue
193 elif ('weight' in name):
194 loss = loss + torch.sum(param ** 2) / 2
195 return loss
196
197
198def get_optimizer(net, optim_name='SGD', lr=0.1, momentum=0.9, weight_decay=0, nesterov=True, bn_wd_skip=True):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected