Ejemplo n.º 1
0
 def test_mlp_profiled(self):
     if th.config.mode in ("DebugMode", "DEBUG_MODE"):
         pytest.skip("Can't profile in DebugMode")
     m = models.Mlp()
     profile = th.compile.profiling.ProfileStats(False)
     f = th.function(m.inputs, m.outputs, profile=profile)
     x_val = self.rng.normal(0, 1, (1000, m.nfeatures))
     f(x_val)
     self.check(f)
Ejemplo n.º 2
0
    def test_mlp(self):
        m = models.Mlp()
        f = th.function(m.inputs, m.outputs)
        pdf = PyDotFormatter()
        graph = pdf(f)
        expected = 11
        if th.config.mode == "FAST_COMPILE":
            expected = 12
        assert len(graph.get_nodes()) == expected
        nc = self.node_counts(graph)

        if th.config.mode == "FAST_COMPILE":
            assert nc["apply"] == 6
        else:
            assert nc["apply"] == 5
        assert nc["output"] == 1
Ejemplo n.º 3
0
 def test_mlp(self):
     m = models.Mlp()
     f = th.function(m.inputs, m.outputs)
     self.check(f)