MCPcopy Create free account
hub / github.com/CausalLearning/robust-unlearnable-examples / get_optim

Function get_optim

utils/generic.py:265–271  ·  view source on GitHub ↗
(optim, params, lr=0.1, weight_decay=1e-4, momentum=0.9)

Source from the content-addressed store, hash-verified

263
264
265def get_optim(optim, params, lr=0.1, weight_decay=1e-4, momentum=0.9):
266 if optim == 'sgd':
267 return torch.optim.SGD(params, lr=lr, weight_decay=weight_decay, momentum=momentum)
268 elif optim == 'adam':
269 return torch.optim.Adam(params, lr=lr, weight_decay=weight_decay)
270
271 raise NotImplementedError('optimizer {} is not supported'.format(optim))
272
273
274def generic_init(args):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected