def test_initialize_depends_on_global_rnd(self): global_rnd.set_seed(1) net1 = build_net(InputLayer(1) >> ForwardLayer(3)) net1.initialize(Gaussian()) global_rnd.set_seed(1) net2 = build_net(InputLayer(1) >> ForwardLayer(3)) net2.initialize(Gaussian()) np.testing.assert_allclose(net1.param_buffer, net2.param_buffer)
def test_initialize_is_random(self): net1 = build_net(InputLayer(1) >> ForwardLayer(3)) net1.initialize(Gaussian()) net2 = build_net(InputLayer(1) >> ForwardLayer(3)) net2.initialize(Gaussian()) self.assertFalse(np.allclose(net1.param_buffer, net2.param_buffer))