From d883929274ec4f8beecc448f27070c5c7298a871 Mon Sep 17 00:00:00 2001 From: Jiangxinz Date: Mon, 19 Jul 2021 14:58:14 +0800 Subject: [PATCH] Fix Bug of Used before Assignment (#34090) * fix used before assign * fix used before assign --- python/paddle/fluid/tests/unittests/test_basic_lstm_api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/paddle/fluid/tests/unittests/test_basic_lstm_api.py b/python/paddle/fluid/tests/unittests/test_basic_lstm_api.py index 5383632838d..bedba672edf 100644 --- a/python/paddle/fluid/tests/unittests/test_basic_lstm_api.py +++ b/python/paddle/fluid/tests/unittests/test_basic_lstm_api.py @@ -68,13 +68,14 @@ def lstm_np(input, return new_hidden, new_cell + mask = None + if batch_first: input = np.tranpose(input, [1, 0, 2]) if mask is not None: mask = np.transpose(mask, [1, 0]) batch_size = input.shape[1] - mask = None if sequence_length is not None: max_seq_len = input.shape[0] -- GitLab