layer init for all sizes
import numpy as np
-def layer_init_uniform(m, h):
- ret = np.random.uniform(-1., 1., size=(m,h))/np.sqrt(m*h)
+def layer_init_uniform(*x):
+ ret = np.random.uniform(-1., 1., size=x)/np.sqrt(np.prod(x))
return ret.astype(np.float32)
def fetch_mnist():
