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

Class Orthogonal

lib/inits.py:25–37  ·  view source on GitHub ↗

benanne lasagne ortho init (faster than qr approach)

Source from the content-addressed store, hash-verified

23 return sharedX(np_rng.normal(loc=self.loc, scale=self.scale, size=shape), name=name)
24
25class Orthogonal(object):
26 """ benanne lasagne ortho init (faster than qr approach)"""
27 def __init__(self, scale=1.1):
28 self.scale = scale
29
30 def __call__(self, shape, name=None):
31 print 'called orthogonal init with shape', shape
32 flat_shape = (shape[0], np.prod(shape[1:]))
33 a = np_rng.normal(0.0, 1.0, flat_shape)
34 u, _, v = np.linalg.svd(a, full_matrices=False)
35 q = u if u.shape == flat_shape else v # pick the one with the correct shape
36 q = q.reshape(shape)
37 return sharedX(self.scale * q[:shape[0], :shape[1]], name=name)
38
39class Frob(object):
40

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected