Skip to content

Commit 60fecce

Browse files
committed
Fix unit test for lstm_unit.
1 parent c0f6f49 commit 60fecce

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

python/paddle/v2/fluid/layers/nn.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,9 +1199,12 @@ def lstm_unit(x_t,
11991199
This layer has two outputs including :math:`h_t` and :math:`o_t`.
12001200
12011201
Args:
1202-
x_t (Variable): The input value of current step, a 2-D tensor.
1203-
hidden_t_prev (Variable): The hidden value of lstm unit, a 2-D tensor.
1204-
cell_t_prev (Variable): The cell value of lstm unit, a 2-D tensor.
1202+
x_t (Variable): The input value of current step, a 2-D tensor with shape
1203+
M x N, M for batch size and N for input size.
1204+
hidden_t_prev (Variable): The hidden value of lstm unit, a 2-D tensor
1205+
with shape M x S, M for batch size and S for size of lstm unit.
1206+
cell_t_prev (Variable): The cell value of lstm unit, a 2-D tensor with
1207+
shape M x S, M for batch size and S for size of lstm unit.
12051208
forget_bias (float): The forget bias of lstm unit.
12061209
param_attr (ParamAttr): The attributes of parameter weights, used to set
12071210
initializer, name etc.

python/paddle/v2/fluid/tests/test_layers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ def test_lstm_unit(self):
177177
name='x_t_data', shape=[10, 10], dtype='float32')
178178
x_t = layers.fc(input=x_t_data, size=10)
179179
prev_hidden_data = layers.data(
180-
name='prev_hidden_data', shape=[10, 20], dtype='float32')
181-
prev_hidden = layers.fc(input=prev_hidden_data, size=20)
180+
name='prev_hidden_data', shape=[10, 30], dtype='float32')
181+
prev_hidden = layers.fc(input=prev_hidden_data, size=30)
182182
prev_cell_data = layers.data(
183183
name='prev_cell', shape=[10, 30], dtype='float32')
184184
prev_cell = layers.fc(input=prev_cell_data, size=30)

0 commit comments

Comments
 (0)