(shape)
return q.reshape(shape)
Orthogonal initilaizer.
Orthogonal initilaizer.
Orthogonal initilaizer .
def orthogonal(shape):
  """Orthogonal initilaizer."""
  flat_shape = (shape[0], np.prod(shape[1:]))
  a = np.random.normal(0.0, 1.0, flat_shape)
  u, _, v = np.linalg.svd(a, full_matrices=False)
  q = u if u.shape == flat_shape else v
  return q.reshape(shape)
def orthogonal ( shape ) : flat_shape = ( shape [ 0 ] , np . prod ( shape [ 1 : ] ) ) a = np . random . normal ( 0.0 , 1.0 , flat_shape ) u , _ , v = np . linalg . svd ( a , full_matrices = False ) q = u if u . shape == flat_shape else v return q . reshape ( shape )