MCPcopy Create free account
hub / github.com/Newmu/dcgan_code / SGD

Class SGD

lib/updates.py:57–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55 raise NotImplementedError
56
57class SGD(Update):
58
59 def __init__(self, lr=0.01, *args, **kwargs):
60 Update.__init__(self, *args, **kwargs)
61 self.__dict__.update(locals())
62
63 def __call__(self, params, cost):
64 updates = []
65 grads = T.grad(cost, params)
66 grads = clip_norms(grads, self.clipnorm)
67 for p,g in zip(params,grads):
68 g = self.regularizer.gradient_regularize(p, g)
69 updated_p = p - self.lr * g
70 updated_p = self.regularizer.weight_regularize(updated_p)
71 updates.append((p, updated_p))
72 return updates
73
74class Momentum(Update):
75

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected