diff --git a/paddle/operators/lstmp_op.cc b/paddle/operators/lstmp_op.cc index 14469c708d0925979c496a2eb3580088bb6c81ba..c96b30ba353fabc48630258ea8f88f741b8c415e 100644 --- a/paddle/operators/lstmp_op.cc +++ b/paddle/operators/lstmp_op.cc @@ -4,7 +4,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at -http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/paddle/operators/lstmp_op.h b/paddle/operators/lstmp_op.h index 9dc37615f0a3266acd728f23356da4b6278f138d..ee82d5c10a5421b181e525f49a263d4808ede62f 100644 --- a/paddle/operators/lstmp_op.h +++ b/paddle/operators/lstmp_op.h @@ -4,7 +4,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at -http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/python/paddle/v2/fluid/tests/test_lstmp_op.py b/python/paddle/v2/fluid/tests/test_lstmp_op.py index 08fc32e117169fdef96a772e6b76463332b4eb40..f137fc61b38f6686a04794993407ca9fed31c56e 100644 --- a/python/paddle/v2/fluid/tests/test_lstmp_op.py +++ b/python/paddle/v2/fluid/tests/test_lstmp_op.py @@ -131,7 +131,10 @@ def lstmp( class TestLstmpOp(OpTest): - def set_argument(self): + def reset_argument(self): + pass + + def setUp(self): self.lod = [[0, 2, 5, 7]] # hidden size self.D = 16 @@ -147,8 +150,7 @@ class TestLstmpOp(OpTest): self.is_reverse = False self.use_peepholes = True - def setUp(self): - self.set_argument() + self.reset_argument() self.op_type = 'lstmp' T = self.lod[0][-1] @@ -212,19 +214,8 @@ class TestLstmpOp(OpTest): class TestLstmpOpHasInitial(TestLstmpOp): - def set_argument(self): - self.lod = [[0, 2, 5, 7]] - self.D = 16 - self.P = 5 - - self.act_gate = 'sigmoid' - self.act_cell = 'tanh' - self.act_cand = 'tanh' - self.act_proj = self.act_cell - + def reset_argument(self): self.has_initial_state = True - self.is_reverse = True - self.use_peepholes = True def test_check_grad(self): # TODO(qingqing) remove folowing lines after the check_grad is refined. @@ -313,52 +304,19 @@ class TestLstmpOpHasInitial(TestLstmpOp): class TestLstmpOpRerverse(TestLstmpOp): - 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.act_proj = self.act_cell - - self.has_initial_state = False + def reset_argument(self): self.is_reverse = True - self.use_peepholes = True class TestLstmpOpNotUsePeepholes(TestLstmpOp): - 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.act_proj = self.act_cell - - self.has_initial_state = False - self.is_reverse = False + def reset_argument(self): self.use_peepholes = False class TestLstmpOpLinearProjection(TestLstmpOp): - 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' + def reset_argument(self): self.act_proj = 'identity' - self.has_initial_state = False - self.is_reverse = False - self.use_peepholes = True - if __name__ == '__main__': unittest.main()