提交 9ee9fefd 编写于 作者: Y yangyaming

Change the return order to h, c.

上级 d993a4f5
...@@ -900,7 +900,7 @@ def lstm_unit(x_t, ...@@ -900,7 +900,7 @@ def lstm_unit(x_t,
i_t = \sigma(L_{i_t}) i_t = \sigma(L_{i_t})
This layer has two outputs including :math:`o_t` and :math:`h_t`. This layer has two outputs including :math:`h_t` and :math:`o_t`.
Args: Args:
x_t (Variable): The input value of current step. x_t (Variable): The input value of current step.
...@@ -915,7 +915,7 @@ def lstm_unit(x_t, ...@@ -915,7 +915,7 @@ def lstm_unit(x_t,
startup_program (Program): the startup program. startup_program (Program): the startup program.
Returns: Returns:
tuple: The cell value and hidden value of lstm unit. tuple: The hidden value and cell value of lstm unit.
Raises: Raises:
ValueError: The ranks of **x_t**, **hidden_t_prev** and **cell_t_prev**\ ValueError: The ranks of **x_t**, **hidden_t_prev** and **cell_t_prev**\
...@@ -929,7 +929,7 @@ def lstm_unit(x_t, ...@@ -929,7 +929,7 @@ def lstm_unit(x_t,
x_t = fluid.layers.fc(input=x_t_data, size=10) x_t = fluid.layers.fc(input=x_t_data, size=10)
prev_hidden = fluid.layers.fc(input=prev_hidden_data, size=20) prev_hidden = fluid.layers.fc(input=prev_hidden_data, size=20)
prev_cell = fluid.layers.fc(input=prev_cell_data, size=30) prev_cell = fluid.layers.fc(input=prev_cell_data, size=30)
cell_value, hidden_value = fluid.layers.lstm_unit(x_t=x_t, hidden_value, cell_value = fluid.layers.lstm_unit(x_t=x_t,
hidden_t_prev=prev_hidden, hidden_t_prev=prev_hidden,
cell_t_prev=prev_cell) cell_t_prev=prev_cell)
""" """
...@@ -977,4 +977,4 @@ def lstm_unit(x_t, ...@@ -977,4 +977,4 @@ def lstm_unit(x_t,
"H": h}, "H": h},
attrs={"forget_bias": forget_bias}) attrs={"forget_bias": forget_bias})
return c, h return h, c
...@@ -161,7 +161,7 @@ class TestBook(unittest.TestCase): ...@@ -161,7 +161,7 @@ class TestBook(unittest.TestCase):
x=dat, label=lbl)) x=dat, label=lbl))
print(str(program)) print(str(program))
def test_seq_expand(self): def test_sequence_expand(self):
program = Program() program = Program()
with program_guard(program): with program_guard(program):
x = layers.data(name='x', shape=[10], dtype='float32') x = layers.data(name='x', shape=[10], dtype='float32')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册