Esempio n. 1
0
    def test_custom_pad():
        actual = aggregated_pad(pad_type="custom",
                                kernel_shape=(1, 2, 3),
                                custom_pad=(7, 8, 9, 10, 11, 12))

        expected = [7 + 8, 9 + 10, 11 + 12]
        np.testing.assert_equal(actual, expected)
Esempio n. 2
0
    def test_valid_pad_2d():
        actual = aggregated_pad(
            pad_type="valid",
            kernel_shape=(1, 2),
        )

        expected = [0, 0]
        np.testing.assert_equal(actual, expected)
Esempio n. 3
0
    def test_same_padding_stride_larger_than_kernel_but_less_than_input():
        actual = aggregated_pad(
            pad_type="same",
            input_shape=(5, 5),
            kernel_shape=(3, 3),
            strides=(4, 4),
        )

        expected = [2, 2]
        np.testing.assert_equal(actual, expected)
Esempio n. 4
0
    def test_same_padding_stride_same_as_input():
        actual = aggregated_pad(
            pad_type="same",
            input_shape=(5, 5),
            kernel_shape=(3, 3),
            strides=(5, 5),
        )

        expected = [0, 0]
        np.testing.assert_equal(actual, expected)
Esempio n. 5
0
    def test_same_padding_no_dilation():
        actual = aggregated_pad(
            pad_type="same",
            input_shape=(5, 6, 7),
            kernel_shape=(2, 2, 2),
            strides=(1, 2, 2),
        )

        expected = [1, 0, 1]
        np.testing.assert_equal(actual, expected)
Esempio n. 6
0
    def test_same_padding_dilation_with_dilation():
        actual = aggregated_pad(
            pad_type="same",
            input_shape=(19, 20, 21),
            kernel_shape=(2, 2, 2),
            strides=(1, 2, 2),
            dilations=(5, 6, 7),
        )

        expected = [5, 5, 7]
        np.testing.assert_equal(actual, expected)
Esempio n. 7
0
    def test_valid_pad_1d(self):
        actual = aggregated_pad(pad_type="valid", kernel_shape=[4])

        expected = [0]
        np.testing.assert_equal(actual, expected)