Skip to content

Instantly share code, notes, and snippets.

@himkt
Created December 11, 2019 12:40
Show Gist options
  • Save himkt/370fa5d1973b0031f0c0d606bd1f86ec to your computer and use it in GitHub Desktop.
Save himkt/370fa5d1973b0031f0c0d606bd1f86ec to your computer and use it in GitHub Desktop.
In [39]: a = chainer.initializers.GlorotUniform(rng=numpy.random.seed(1))
In [40]: a2 = copy.deepcopy(a)
In [41]: a(b)
In [42]: b
Out[42]:
array([[-0.09089784, 0.24135339, -0.54759727, -0.21653382, -0.38695953,
-0.44657069, -0.34368472, -0.16917975, -0.11308557, 0.0425216 ],
[-0.08851797, 0.2028978 , -0.32375634, 0.4142069 , -0.51772095,
0.1867378 , -0.09058805, 0.06429149, -0.39393637, -0.33071325],
[ 0.32944917, 0.51295486, -0.20438357, 0.21067887, 0.41231366,
0.43226994, -0.45456129, -0.50494019, -0.36168265, 0.41423436],
[-0.439989 , -0.08642227, 0.50159285, 0.03633075, 0.21019085,
-0.2020925 , 0.20430153, 0.36656406, -0.52768875, 0.27401937],
[ 0.53552049, 0.27185185, -0.24051156, 0.31688963, -0.43464413,
-0.05707978, 0.44759395, -0.22608437, -0.23248047, -0.40528339],
[-0.52650712, 0.19590451, -0.31589557, -0.25683077, -0.00923114,
-0.48926682, 0.08119177, -0.38698946, 0.09782931, 0.21882432],
[-0.43562081, -0.09414695, 0.2129547 , -0.0940119 , -0.49300128,
0.03932254, 0.17942804, 0.01631021, 0.48702915, 0.0948163 ],
[ 0.44190466, -0.39712656, -0.39515296, 0.33673029, -0.11208941,
-0.36658611, 0.46831219, -0.16676415, 0.27475089, 0.24756839],
[ 0.41989079, 0.13547612, 0.27489366, -0.16552357, -0.25203137,
0.43367162, -0.07877215, 0.50920676, 0.17904119, 0.13331098],
[-0.42202464, 0.49239081, -0.05486851, 0.08587152, -0.10063109,
-0.28807251, 0.44188013, 0.08071183, -0.54457827, 0.12832582]])
In [43]: a2(b)
In [44]: b
Out[44]:
array([[-0.189901 , 0.02964067, 0.42277839, -0.15635314, 0.44752784,
0.13513424, -0.53039125, 0.47042492, 0.2091171 , 0.54478989],
[-0.35893299, -0.39749787, 0.47388459, 0.21560349, -0.47542299,
0.27984575, 0.27810743, 0.46340016, 0.23171376, -0.41159054],
[-0.52594496, -0.51900986, -0.51671435, -0.27801185, 0.39439086,
0.0425373 , 0.05786358, 0.37467607, -0.41169751, -0.24189216],
[ 0.09394457, 0.51441637, 0.06685526, -0.52729548, 0.32932659,
-0.29251203, 0.33641689, -0.12284251, 0.39824015, 0.2707082 ],
[ 0.06160809, -0.39824335, -0.48208602, -0.41479746, -0.49891842,
-0.42996864, -0.30047037, 0.23331774, 0.06541668, -0.53396817],
[-0.46887868, 0.51187557, 0.07460032, -0.32502598, -0.27131355,
0.26709784, -0.33364029, 0.08912424, 0.5148811 , 0.37993192],
[-0.2849825 , -0.00682494, 0.13140491, 0.36038052, -0.37596619,
-0.52737335, -0.47101714, -0.01495818, 0.11647809, 0.07542297],
[-0.20006946, 0.53525218, 0.08735651, -0.13129877, 0.05581098,
0.2687504 , 0.18538535, -0.25751772, -0.47505639, -0.14231563],
[ 0.14209841, -0.31748847, 0.27687984, -0.47483549, -0.26256165,
0.3338419 , -0.33582592, 0.15277174, 0.02702497, 0.46535382],
[-0.2592954 , -0.4754658 , 0.25750186, 0.29815609, 0.44673988,
0.47320169, -0.53243938, -0.29099176, 0.12792428, 0.49187274]])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment