benanne lasagne ortho init (faster than qr approach)
| 23 | return sharedX(np_rng.normal(loc=self.loc, scale=self.scale, size=shape), name=name) |
| 24 | |
| 25 | class 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 | |
| 39 | class Frob(object): |
| 40 |
nothing calls this directly
no outgoing calls
no test coverage detected