def test_graph_parameters(self): np.random.seed(0) net1 = Vector(10) >> Full(10) net2 = net1 >> Full(10) self.assertEqual(net1.get_state(), net2.left.get_state())
def test_freeze_parameters(self): np.random.seed(0) net1 = Vector(10) >> Linear(10) net1.initialize() self.assertEqual(net1.freeze().get_state(as_list=True), net1.get_state(as_list=True))
def test_graph_parameters(self): np.random.seed(0) net1 = Vector(10) >> Linear(10) net2 = net1 >> Linear(10) self.assertEqual(net1.get_state(as_list=True), net2.left.get_state(as_list=True))
def test_freeze_parameters(self): np.random.seed(0) net1 = Vector(10) >> Full(10) self.assertEqual(net1.freeze().get_state(), net1.get_state())
def test_freeze(self): net1 = Vector(10) >> Full(10) self.assertEqual(Freeze(net1).get_state(), net1.get_state()) self.assertEqual(Freeze(net1).get_parameters(), [])