MCPcopy
hub / github.com/junyanz/iGAN / __call__

Method __call__

lib/updates.py:146–159  ·  view source on GitHub ↗
(self, params, cost)

Source from the content-addressed store, hash-verified

144 self.__dict__.update(locals())
145
146 def __call__(self, params, cost):
147 updates = []
148 grads = T.grad(cost, params)
149 grads = clip_norms(grads, self.clipnorm)
150 for p, g in zip(params, grads):
151 g = self.regularizer.gradient_regularize(p, g)
152 acc = theano.shared(p.get_value() * 0.)
153 acc_new = self.rho * acc + (1 - self.rho) * g ** 2
154 updates.append((acc, acc_new))
155
156 updated_p = p - self.lr * (g / T.sqrt(acc_new + self.epsilon))
157 updated_p = self.regularizer.weight_regularize(updated_p)
158 updates.append((p, updated_p))
159 return updates
160
161
162class Adam(Update):

Callers

nothing calls this directly

Calls 3

clip_normsFunction · 0.85
gradient_regularizeMethod · 0.80
weight_regularizeMethod · 0.80

Tested by

no test coverage detected