319882b5679229124774e91d5c5762853d75f3ce,test/agent/net/test_nn.py,TestNet,test_output,#TestNet#Any#,109

Before Change


    def test_output(self, test_nets):
        """ Checks that the output of the net is not zero or nan """
        net = test_nets[0]
        if type(net.in_dim) is int:
            dummy_input = Variable(torch.ones(2, net.in_dim))
        else:
            dummy_input = Variable(torch.ones(2, *net.in_dim))
        out = net(dummy_input)
        flag = True
        if torch.sum(torch.abs(out.data)) < SMALL_NUM:
            print("FAIL")

After Change


    def test_output(self, test_nets):
        """ Checks that the output of the net is not zero or nan """
        net = test_nets[0]
        dummy_input = self.init_dummy_input(net)
        dummy_output = self.init_dummy_output(net)
        out = net(dummy_input)
        flag = True
        if net.__class__.__name__.find("MultiMLPNet") != -1:
            zero_test = sum([torch.sum(torch.abs(x.data)) for x in out])
            nan_test = np.isnan(sum([torch.sum(x.data) for x in out]))
        else:
            zero_test = torch.sum(torch.abs(out.data))
            nan_test = np.isnan(torch.sum(out.data))
        if zero_test < SMALL_NUM:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 16

Instances


Project Name: kengz/SLM-Lab
Commit Name: 319882b5679229124774e91d5c5762853d75f3ce
Time: 2018-01-06
Author: lgraesser@users.noreply.github.com
File Name: test/agent/net/test_nn.py
Class Name: TestNet
Method Name: test_output


Project Name: kengz/SLM-Lab
Commit Name: 319882b5679229124774e91d5c5762853d75f3ce
Time: 2018-01-06
Author: lgraesser@users.noreply.github.com
File Name: test/agent/net/test_nn.py
Class Name: TestNet
Method Name: test_output


Project Name: kengz/SLM-Lab
Commit Name: 319882b5679229124774e91d5c5762853d75f3ce
Time: 2018-01-06
Author: lgraesser@users.noreply.github.com
File Name: test/agent/net/test_nn.py
Class Name: TestNet
Method Name: test_trainable


Project Name: kengz/SLM-Lab
Commit Name: 319882b5679229124774e91d5c5762853d75f3ce
Time: 2018-01-06
Author: lgraesser@users.noreply.github.com
File Name: test/agent/net/test_nn.py
Class Name: TestNet
Method Name: test_fixed