From 5c2318a989e003a5293eee844e3da79b77380c8e Mon Sep 17 00:00:00 2001 From: yangyaming Date: Mon, 22 Jan 2018 13:40:11 +0800 Subject: [PATCH] Add unit test for python wrapper. --- python/paddle/v2/fluid/layers/nn.py | 3 ++- python/paddle/v2/fluid/tests/test_layers.py | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/python/paddle/v2/fluid/layers/nn.py b/python/paddle/v2/fluid/layers/nn.py index 33dc985ba..10a7dd4b0 100644 --- a/python/paddle/v2/fluid/layers/nn.py +++ b/python/paddle/v2/fluid/layers/nn.py @@ -1985,7 +1985,8 @@ def row_conv(input, future_context_size, param_attr=None, act=None): In the above equation: * :math:`Out_{i}`: The i-th row of output variable with shape [1, D]. - * :math:`\\tau`: Future context size. + * :math:`\\tau`: Future context size. Please note, the shape of + convolution kernel is [future_context_size + 1, D]. * :math:`X_{j}`: The j-th row of input variable with shape [1, D]. * :math:`W_{i-j}`: The (i-j)-th row of parameters with shape [1, D]. diff --git a/python/paddle/v2/fluid/tests/test_layers.py b/python/paddle/v2/fluid/tests/test_layers.py index 709abd6c6..01b3db426 100644 --- a/python/paddle/v2/fluid/tests/test_layers.py +++ b/python/paddle/v2/fluid/tests/test_layers.py @@ -225,6 +225,14 @@ class TestBook(unittest.TestCase): self.assertIsNotNone(out) print(str(program)) + def test_row_conv(self): + program = Program() + with program_guard(program): + x = layers.data(name='x', shape=[16], dtype='float32', lod_level=1) + out = layers.row_conv(input=x, future_context_size=2) + self.assertIsNotNone(out) + print(str(program)) + if __name__ == '__main__': unittest.main() -- GitLab