示例#1
0
 def test_forwardFork21(self):
     n = mlp(sizes=[2, 1],
             weightGenerator=lambda: 1,
             biasGenerator=lambda: 0,
             activationFunction=Identity())
     assert_allclose(n.forward([0, 0]), [0])
     assert_allclose(n.forward([10, 10]), [20])
     assert_allclose(n.forward([-11, -10]), [-21])
示例#2
0
 def test_forwardChain(self):
     n = mlp(sizes=[1, 1, 1],
             weightGenerator=lambda: 1,
             biasGenerator=lambda: 0,
             activationFunction=Identity())
     assert_allclose(n.forward([0]), [0])
     assert_allclose(n.forward([10]), [10])
     assert_allclose(n.forward([-11]), [-11])
示例#3
0
 def test_construct(self):
     n = mlp([1, 2, 2, 1])
     n.forward([1])