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

Method gradient_regularize

lib/updates.py:37–40  ·  view source on GitHub ↗
(self, p, g)

Source from the content-addressed store, hash-verified

35 return (p / T.sqrt(T.sum(T.sqr(p)))) * T.sqrt(nrows)
36
37 def gradient_regularize(self, p, g):
38 g += p * self.l2
39 g += T.sgn(p) * self.l1
40 return g
41
42 def weight_regularize(self, p):
43 p = self.max_norm(p, self.maxnorm)

Callers 7

__call__Method · 0.80
__call__Method · 0.80
__call__Method · 0.80
__call__Method · 0.80
__call__Method · 0.80
__call__Method · 0.80
__call__Method · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected