From a3d1f86947dc46dfbff734cf0b5b529eaff4703e Mon Sep 17 00:00:00 2001 From: Yibing Liu Date: Tue, 23 Jan 2018 10:27:44 -0800 Subject: [PATCH] Add unit test for linear projection --- python/paddle/v2/fluid/tests/test_lstmp_op.py | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/python/paddle/v2/fluid/tests/test_lstmp_op.py b/python/paddle/v2/fluid/tests/test_lstmp_op.py index a0f6955d772..8835cae504c 100644 --- a/python/paddle/v2/fluid/tests/test_lstmp_op.py +++ b/python/paddle/v2/fluid/tests/test_lstmp_op.py @@ -192,7 +192,8 @@ class TestLstmOp(OpTest): 'is_reverse': self.is_reverse, 'gate_activation': self.act_gate, 'cell_activation': self.act_cell, - 'candidate_activation': self.act_cand + 'candidate_activation': self.act_cand, + 'share_cell_act': self.share_cell_act } def test_check_output(self): @@ -340,9 +341,25 @@ class TestLstmOpNotUsePeepholes(TestLstmOp): self.share_cell_act = True self.has_initial_state = False - self.is_reverse = True + self.is_reverse = False self.use_peepholes = False +class TestLstmOpNotShareCellAct(TestLstmOp): + def set_argument(self): + self.lod = [[0, 2, 5, 7]] + self.D = 16 + self.P = 10 + + self.act_gate = 'sigmoid' + self.act_cell = 'tanh' + self.act_cand = 'tanh' + + self.share_cell_act = False + self.has_initial_state = False + self.is_reverse = False + self.use_peepholes = True + + if __name__ == '__main__': unittest.main() -- GitLab