def test_set_seed(self):
     w_init = Xavier()
     b_init = Zeros()
     l1 = Linear(10, 20).set_init_method(w_init, b_init).set_name("linear1").set_seed(1234).reset()  # noqa
     l2 = Linear(10, 20).set_init_method(w_init, b_init).set_name("linear2").set_seed(1234).reset()  # noqa
     p1 = l1.parameters()
     p2 = l2.parameters()
     self.assertTrue((p1["linear1"]["weight"] == p2["linear2"]["weight"]).all())  # noqa
示例#2
0
 def test_set_seed(self):
     w_init = Xavier()
     b_init = Zeros()
     l1 = Linear(10, 20).set_init_method(w_init, b_init).set_name("linear1").set_seed(
         1234).reset()  # noqa
     l2 = Linear(10, 20).set_init_method(w_init, b_init).set_name("linear2").set_seed(
         1234).reset()  # noqa
     p1 = l1.parameters()
     p2 = l2.parameters()
     assert (p1["linear1"]["weight"] == p2["linear2"]["weight"]).all()  # noqa
 def test_set_seed(self):
     l1 = Linear(
         10, 20,
         "Xavier").set_name("linear1").set_seed(1234).reset()  # noqa
     l2 = Linear(
         10, 20,
         "Xavier").set_name("linear2").set_seed(1234).reset()  # noqa
     p1 = l1.parameters()
     p2 = l2.parameters()
     self.assertTrue(
         (p1["linear1"]["weight"] == p2["linear2"]["weight"]).all())  # noqa