bc5e993ae30a59d7bcdfa03513ecc3d43b58a5f7,tests/auto/keras/layers/test_core.py,TestMasking,test_sequences,#TestMasking#,119

Before Change


        // integer inputs, one per timestep, like embeddings
        layer = core.Masking()
        func = theano.function([layer.input], layer.get_output_mask())
        self.assertTrue(np.all(
            // get mask for this input
            func(np.array([[[1], [2], [3], [0]],
                          [[0], [4], [5], [0]]], dtype=np.int32)) ==
            // This is the expected output mask, one dimension less
            np.array([[1, 1, 1, 0], [0, 1, 1, 0]])))

    def test_non_zero(self):
        Test masking with non-zero mask value
        layer = core.Masking(5)

After Change


        // integer inputs, one per timestep, like embeddings
        layer = core.Masking()
        func = K.function([layer.input], [layer.get_output_mask()])
        input_data = np.array([[[1], [2], [3], [0]],
                              [[0], [4], [5], [0]]], dtype=np.int32)

        // This is the expected output mask, one dimension less
        expected = np.array([[1, 1, 1, 0], [0, 1, 1, 0]])

        // get mask for this input
        output = func([input_data])[0]
        self.assertTrue(np.all(output == expected))

    def test_non_zero(self):
        Test masking with non-zero mask value
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: keras-team/keras
Commit Name: bc5e993ae30a59d7bcdfa03513ecc3d43b58a5f7
Time: 2015-11-19
Author: francois.chollet@gmail.com
File Name: tests/auto/keras/layers/test_core.py
Class Name: TestMasking
Method Name: test_sequences


Project Name: keras-team/keras
Commit Name: bc5e993ae30a59d7bcdfa03513ecc3d43b58a5f7
Time: 2015-11-19
Author: francois.chollet@gmail.com
File Name: tests/auto/keras/layers/test_core.py
Class Name: TestMasking
Method Name: test_non_zero_output


Project Name: keras-team/keras
Commit Name: bc5e993ae30a59d7bcdfa03513ecc3d43b58a5f7
Time: 2015-11-19
Author: francois.chollet@gmail.com
File Name: tests/auto/keras/layers/test_core.py
Class Name: TestMasking
Method Name: test_non_zero