예제 #1
0
    def test_calls_relu_activation(self):
        with unittest.mock.patch(
            'deepen.propagation.relu',
            wraps = prop.relu
        ) as relu_spy:
            prop.layer_forward(*self.params, 'relu')

            relu_spy.assert_called_once()
예제 #2
0
    def test_calls_sigmoid(self):
        with unittest.mock.patch(
            'deepen.propagation.sigmoid',
            wraps = prop.sigmoid
        ) as sigmoid_spy:
            prop.layer_forward(*self.params, 'sigmoid')

            sigmoid_spy.assert_called_once()
예제 #3
0
    def test_linear_cache_contains_the_inputs(self):
        _, (linear_cache, _) = prop.layer_forward(*self.params, 'relu')

        subtests = zip(linear_cache, self.params, ('A', 'W', 'b'))
        for cached, param, description in subtests:
            with self.subTest(parameter = description):
                self.assertTrue(np.array_equal(cached, param))
예제 #4
0
    def test_A_has_the_correct_shape(self):
        A, _ = prop.layer_forward(*self.params, 'relu')

        self.assertTrue(A.shape == self.Z.shape)
예제 #5
0
    def test_activation_cache_has_the_correct_shape(self):
        _, (_, activation_cache) = prop.layer_forward(*self.params, 'relu')

        self.assertTrue(activation_cache.shape == self.Z.shape)