コード例 #1
0
 def test_equal_layers(self):
     """ Should return True, as the net is equal to itself. """
     net = Net(NetNames.CONV,
               DatasetNames.MNIST,
               plan_conv=[2, 'M'],
               plan_fc=[2])
     self.assertIs(net.equal_layers(other=net), True)
コード例 #2
0
 def test_equal_layers_unequal_types(self):
     """ Should return False, as two layers have unequal activation functions. """
     net0 = Net(NetNames.LENET,
                DatasetNames.MNIST,
                plan_conv=[2, 'M'],
                plan_fc=[2])
     net1 = Net(NetNames.CONV,
                DatasetNames.MNIST,
                plan_conv=[2, 'M'],
                plan_fc=[2])
     self.assertIs(net0.equal_layers(other=net1), False)
コード例 #3
0
 def test_equal_layers_unequal_weights(self):
     """ Should return False, as two layers contain unequal 'weight'-attributes. """
     torch.manual_seed(0)
     net0 = Net(NetNames.CONV,
                DatasetNames.MNIST,
                plan_conv=[2, 'M'],
                plan_fc=[2])
     torch.manual_seed(1)
     net1 = Net(NetNames.CONV,
                DatasetNames.MNIST,
                plan_conv=[2, 'M'],
                plan_fc=[2])
     self.assertIs(net0.equal_layers(other=net1), False)