diff --git a/python/paddle/fluid/layers/utils.py b/python/paddle/fluid/layers/utils.py index f877a00c511273f5d596858bc3a0e778871dd877..b8fb17a8028c7b9d21874809f8d7c8f4387f3a3d 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()