From 4e4d58b3b1bbf6cef11385ad557fb6687f424172 Mon Sep 17 00:00:00 2001 From: Siming Dai <908660116@qq.com> Date: Thu, 23 Dec 2021 14:02:56 +0800 Subject: [PATCH] Fixed corner case in fill_constant (#38284) --- python/paddle/fluid/layers/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/paddle/fluid/layers/utils.py b/python/paddle/fluid/layers/utils.py index f877a00c51..b8fb17a802 100644 --- a/python/paddle/fluid/layers/utils.py +++ b/python/paddle/fluid/layers/utils.py @@ -363,7 +363,7 @@ def convert_shape_to_list(shape): """ if isinstance(shape, (list, tuple)): shape = list( - map(lambda x: x.numpy()[0] if isinstance(x, Variable) else x, + map(lambda x: x.numpy().flat[0] if isinstance(x, Variable) else x, shape)) else: shape = shape.numpy().astype(int).tolist() -- GitLab