From afeb394e8db9a9ddb089f34919267fcf7b4a4617 Mon Sep 17 00:00:00 2001 From: liu zhengxi <380185688@qq.com> Date: Mon, 19 Dec 2022 16:25:07 +0800 Subject: [PATCH] update (#49155) --- python/paddle/nn/layer/rnn.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/python/paddle/nn/layer/rnn.py b/python/paddle/nn/layer/rnn.py index 7fbce5abc0b..2617c76ae6e 100644 --- a/python/paddle/nn/layer/rnn.py +++ b/python/paddle/nn/layer/rnn.py @@ -29,6 +29,7 @@ from paddle.nn import Layer from paddle.nn import functional as F from paddle.nn import initializer as I from paddle.static import Variable, default_startup_program, program_guard +from paddle.tensor.manipulation import tensor_array_to_tensor from .container import LayerList @@ -319,14 +320,10 @@ def _rnn_static_graph( new_cond = paddle.tensor.less_than(start_i, end) paddle.fluid.layers.assign(new_cond, cond) - out, _ = paddle.fluid.layers.tensor_array_to_tensor( - out_array, axis=0, use_stack=True - ) + out, _ = tensor_array_to_tensor(out_array, axis=0, use_stack=True) all_state = map_structure( - lambda x: paddle.fluid.layers.tensor_array_to_tensor( - x, axis=0, use_stack=True - )[0], + lambda x: tensor_array_to_tensor(x, axis=0, use_stack=True)[0], init_array, ) final_outputs = out -- GitLab