Beispiel #1
0
    def test_evaluateDerivativeOnVectors(self):
        tanh = Tanh()

        vector = num.array([1, 2, 3])
        num.testing.assert_array_equal(tanh.derivative(vector),
                                       num.array([0, -3, -8]))
Beispiel #2
0
    def test_evaluateDerivativeOnNumbers(self):
        tanh = Tanh()

        self.assertEqual(tanh.derivative(1), 0)
        self.assertEqual(tanh.derivative(2), -3)