From 0d6c7532be2e5e44edc1326aa7a22bcb261b31ac Mon Sep 17 00:00:00 2001 From: Aurelius84 Date: Tue, 6 Jul 2021 15:57:55 +0800 Subject: [PATCH] [Cherry-pick][Dy2Stat] Fix unique_name in create_static_variable_gast_node (#33963) (#33980) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug fixes, [Cherry-pick][Dy2Stat] Fix unique_name in create_static_variable_gast_node (#33963) --- .../fluid/dygraph/dygraph_to_static/variable_trans_func.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/paddle/fluid/dygraph/dygraph_to_static/variable_trans_func.py b/python/paddle/fluid/dygraph/dygraph_to_static/variable_trans_func.py index 673d30cffbe..eb791394069 100644 --- a/python/paddle/fluid/dygraph/dygraph_to_static/variable_trans_func.py +++ b/python/paddle/fluid/dygraph/dygraph_to_static/variable_trans_func.py @@ -18,6 +18,7 @@ import six import gast from paddle.fluid import core +from paddle.fluid import unique_name from paddle.fluid.framework import Variable from paddle.fluid.layers import fill_constant from paddle.fluid.layer_helper import LayerHelper @@ -84,7 +85,7 @@ def to_static_variable_gast_node(name): def create_static_variable_gast_node(name): func_code = "{} = paddle.jit.dy2static\ .data_layer_not_check(name='{}', shape=[-1], dtype='float32')".format( - name, name) + name, unique_name.generate(name)) return gast.parse(func_code).body[0] -- GitLab