From 4af3ec0f8affa52c56c4cb4527767f2b68e34668 Mon Sep 17 00:00:00 2001 From: Xing Wu Date: Mon, 11 May 2020 16:15:17 +0800 Subject: [PATCH] fix rnn check_type list error (#24346) * fix rnn check_type list error * tigger ci, test=develop * update modify, test=develop --- python/paddle/fluid/layers/rnn.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/python/paddle/fluid/layers/rnn.py b/python/paddle/fluid/layers/rnn.py index c99578bb348..cd1499d4e47 100644 --- a/python/paddle/fluid/layers/rnn.py +++ b/python/paddle/fluid/layers/rnn.py @@ -494,8 +494,14 @@ def rnn(cell, if isinstance(initial_states, (list, tuple)): states = map_structure(lambda x: x, initial_states)[0] for i, state in enumerate(states): - check_variable_and_dtype(state, 'states[' + str(i) + ']', - ['float32', 'float64'], 'rnn') + if isinstance(state, (list, tuple)): + for j, state_j in enumerate(state): + check_variable_and_dtype(state_j, 'state_j[' + str(j) + ']', + ['float32', 'float64'], 'rnn') + else: + check_variable_and_dtype(state, 'states[' + str(i) + ']', + ['float32', 'float64'], 'rnn') + check_type(sequence_length, 'sequence_length', (Variable, type(None)), 'rnn') -- GitLab