diff --git a/python/paddle/fluid/tests/unittests/dygraph_to_static/test_logical.py b/python/paddle/fluid/tests/unittests/dygraph_to_static/test_logical.py index 97213982ba6f7882df6b2bcb9dc512c9423cf328..97454a8cefb5a69b8f6d4b75e0ec83f34f503a10 100644 --- a/python/paddle/fluid/tests/unittests/dygraph_to_static/test_logical.py +++ b/python/paddle/fluid/tests/unittests/dygraph_to_static/test_logical.py @@ -21,7 +21,8 @@ import numpy as np import paddle import paddle.fluid as fluid -from paddle.fluid.dygraph.dygraph_to_static.logical_transformer import ( +from paddle.jit import ProgramTranslator +from paddle.jit.dy2static.logical_transformer import ( cmpop_node_to_str, ) from paddle.jit import ProgramTranslator diff --git a/python/paddle/jit/dy2static/assert_transformer.py b/python/paddle/jit/dy2static/assert_transformer.py index 96b2abca217cdab1c2fad5fecf6ef745ffcccc4e..3a8a8b01aecc8b9caf4f14b5c5cffd7eeaa7cfa4 100644 --- a/python/paddle/jit/dy2static/assert_transformer.py +++ b/python/paddle/jit/dy2static/assert_transformer.py @@ -18,7 +18,7 @@ from paddle.fluid.dygraph.dygraph_to_static.static_analysis import ( AstNodeWrapper, ) from paddle.fluid.dygraph.dygraph_to_static.utils import ast_to_source_code -from paddle.fluid.dygraph.dygraph_to_static.base_transformer import ( +from .base_transformer import ( BaseTransformer, ) diff --git a/python/paddle/jit/dy2static/ast_transformer.py b/python/paddle/jit/dy2static/ast_transformer.py index f99c85c94a58e1e11853b21b70505c31b1917244..b23a6dc368ad3762b7d90ee64fcbc65770f5ad2a 100644 --- a/python/paddle/jit/dy2static/ast_transformer.py +++ b/python/paddle/jit/dy2static/ast_transformer.py @@ -18,7 +18,7 @@ # See details in https://github.com/serge-sans-paille/gast/ import os -from paddle.fluid.dygraph.dygraph_to_static.base_transformer import ( +from .base_transformer import ( BaseTransformer, ) from .early_return_transformer import ( @@ -27,47 +27,47 @@ from .early_return_transformer import ( from .assert_transformer import ( AssertTransformer, ) -from paddle.fluid.dygraph.dygraph_to_static.basic_api_transformer import ( +from .basic_api_transformer import ( BasicApiTransformer, ) from .break_continue_transformer import ( BreakContinueTransformer, BreakTransformOptimizer, ) -from paddle.fluid.dygraph.dygraph_to_static.call_transformer import ( +from .call_transformer import ( CallTransformer, ) -from paddle.fluid.dygraph.dygraph_to_static.cast_transformer import ( +from .cast_transformer import ( CastTransformer, ) -from paddle.fluid.dygraph.dygraph_to_static.typehint_transformer import ( +from .typehint_transformer import ( TypeHintTransformer, ) from .ifelse_transformer import ( IfElseTransformer, ) -from paddle.fluid.dygraph.dygraph_to_static.logical_transformer import ( +from .logical_transformer import ( LogicalTransformer, ) from .loop_transformer import ( LoopTransformer, ) -from paddle.fluid.dygraph.dygraph_to_static.print_transformer import ( +from .print_transformer import ( PrintTransformer, ) from .return_transformer import ( ReturnTransformer, ) -from paddle.fluid.dygraph.dygraph_to_static.create_variable_transformer import ( +from .create_variable_transformer import ( CreateVariableTransformer, ) from paddle.fluid.dygraph.dygraph_to_static.static_analysis import ( StaticAnalysisVisitor, ) -from paddle.fluid.dygraph.dygraph_to_static.tensor_shape_transformer import ( +from .tensor_shape_transformer import ( TensorShapeTransformer, ) -from paddle.fluid.dygraph.dygraph_to_static.decorator_transformer import ( +from .decorator_transformer import ( DecoratorTransformer, ) diff --git a/python/paddle/fluid/dygraph/dygraph_to_static/base_transformer.py b/python/paddle/jit/dy2static/base_transformer.py similarity index 95% rename from python/paddle/fluid/dygraph/dygraph_to_static/base_transformer.py rename to python/paddle/jit/dy2static/base_transformer.py index 5f082acca5d401e02ecdfb6a722b1ee23693a80b..518805250de93a0c3a293aa061613f09ac326aeb 100644 --- a/python/paddle/fluid/dygraph/dygraph_to_static/base_transformer.py +++ b/python/paddle/jit/dy2static/base_transformer.py @@ -14,25 +14,17 @@ from paddle.utils import gast from paddle.fluid import unique_name -from paddle.fluid.dygraph.dygraph_to_static.utils import get_attribute_full_name -from paddle.fluid.dygraph.dygraph_to_static.utils import ast_to_source_code -from paddle.fluid.dygraph.dygraph_to_static.utils import create_assign_node -from paddle.fluid.dygraph.dygraph_to_static.utils import ORIGI_INFO -from paddle.fluid.dygraph.dygraph_to_static.utils import FOR_ITER_INDEX_PREFIX -from paddle.fluid.dygraph.dygraph_to_static.utils import FOR_ITER_TUPLE_PREFIX -from paddle.fluid.dygraph.dygraph_to_static.utils import ( - FOR_ITER_TUPLE_INDEX_PREFIX, -) -from paddle.fluid.dygraph.dygraph_to_static.utils import FOR_ITER_VAR_LEN_PREFIX from paddle.fluid.dygraph.dygraph_to_static.utils import ( + ORIGI_INFO, + FOR_ITER_INDEX_PREFIX, + FOR_ITER_VAR_LEN_PREFIX, + FOR_ITER_TARGET_PREFIX, FOR_ITER_VAR_NAME_PREFIX, -) -from paddle.fluid.dygraph.dygraph_to_static.utils import ( FOR_ITER_ZIP_TO_LIST_PREFIX, -) -from paddle.fluid.dygraph.dygraph_to_static.utils import FOR_ITER_TARGET_PREFIX -from paddle.fluid.dygraph.dygraph_to_static.utils import ( FOR_ITER_ITERATOR_PREFIX, + create_assign_node, + ast_to_source_code, + get_attribute_full_name, ) diff --git a/python/paddle/fluid/dygraph/dygraph_to_static/basic_api_transformer.py b/python/paddle/jit/dy2static/basic_api_transformer.py similarity index 98% rename from python/paddle/fluid/dygraph/dygraph_to_static/basic_api_transformer.py rename to python/paddle/jit/dy2static/basic_api_transformer.py index d6c32a1fc2bd12ebdbd18d79ac8de2d0d132872a..8a80fc4e6ed64102575802923ec858e6e9faea73 100644 --- a/python/paddle/fluid/dygraph/dygraph_to_static/basic_api_transformer.py +++ b/python/paddle/jit/dy2static/basic_api_transformer.py @@ -19,7 +19,7 @@ from paddle.fluid.dygraph.dygraph_to_static.static_analysis import ( AstNodeWrapper, ) from paddle.fluid.dygraph.dygraph_to_static import utils -from paddle.fluid.dygraph.dygraph_to_static.base_transformer import ( +from .base_transformer import ( BaseTransformer, ) from paddle.fluid.dygraph.dygraph_to_static.utils import ast_to_source_code diff --git a/python/paddle/jit/dy2static/break_continue_transformer.py b/python/paddle/jit/dy2static/break_continue_transformer.py index 7ee451b736158fda4a1ce24231c41f118e707a55..23576fdf9849ec7c49d140477d202ae0a0aa443f 100644 --- a/python/paddle/jit/dy2static/break_continue_transformer.py +++ b/python/paddle/jit/dy2static/break_continue_transformer.py @@ -20,10 +20,10 @@ from paddle.fluid.dygraph.dygraph_to_static.utils import BaseNodeVisitor from paddle.fluid.dygraph.dygraph_to_static.variable_trans_func import ( create_bool_node, ) -from paddle.fluid.dygraph.dygraph_to_static.base_transformer import ( +from .base_transformer import ( BaseTransformer, ) -from paddle.fluid.dygraph.dygraph_to_static.base_transformer import ( +from .base_transformer import ( ForNodeVisitor, ) diff --git a/python/paddle/fluid/dygraph/dygraph_to_static/call_transformer.py b/python/paddle/jit/dy2static/call_transformer.py similarity index 97% rename from python/paddle/fluid/dygraph/dygraph_to_static/call_transformer.py rename to python/paddle/jit/dy2static/call_transformer.py index 043102b0f661aa2753a65437a048b32268debc1e..7380934d47e16aca5da901c6b5a1e3afaba622ec 100644 --- a/python/paddle/fluid/dygraph/dygraph_to_static/call_transformer.py +++ b/python/paddle/jit/dy2static/call_transformer.py @@ -19,7 +19,7 @@ from paddle.fluid.dygraph.dygraph_to_static.static_analysis import ( ) from paddle.fluid.dygraph.dygraph_to_static.utils import ast_to_source_code from paddle.fluid.dygraph.dygraph_to_static.utils import is_paddle_api -from paddle.fluid.dygraph.dygraph_to_static.base_transformer import ( +from .base_transformer import ( BaseTransformer, ) diff --git a/python/paddle/fluid/dygraph/dygraph_to_static/cast_transformer.py b/python/paddle/jit/dy2static/cast_transformer.py similarity index 96% rename from python/paddle/fluid/dygraph/dygraph_to_static/cast_transformer.py rename to python/paddle/jit/dy2static/cast_transformer.py index 7a5821e12f5bf2b857ea0695dc5c61d4a5977c04..ca1bf11c43897f844532a66169437d00eece8d2c 100644 --- a/python/paddle/fluid/dygraph/dygraph_to_static/cast_transformer.py +++ b/python/paddle/jit/dy2static/cast_transformer.py @@ -18,7 +18,7 @@ from paddle.fluid.dygraph.dygraph_to_static.static_analysis import ( AstNodeWrapper, ) from paddle.fluid.dygraph.dygraph_to_static.utils import ast_to_source_code -from paddle.fluid.dygraph.dygraph_to_static.base_transformer import ( +from .base_transformer import ( BaseTransformer, ) diff --git a/python/paddle/fluid/dygraph/dygraph_to_static/create_variable_transformer.py b/python/paddle/jit/dy2static/create_variable_transformer.py similarity index 94% rename from python/paddle/fluid/dygraph/dygraph_to_static/create_variable_transformer.py rename to python/paddle/jit/dy2static/create_variable_transformer.py index 3432765191fdda8840298e94f45f5f7f33e94504..feccbfe594e137972dca940b2bd1c60b6464cdcf 100644 --- a/python/paddle/fluid/dygraph/dygraph_to_static/create_variable_transformer.py +++ b/python/paddle/jit/dy2static/create_variable_transformer.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from paddle.utils import gast from paddle.fluid.dygraph.dygraph_to_static.static_analysis import ( AstNodeWrapper, ) @@ -22,7 +21,7 @@ from paddle.fluid.dygraph.dygraph_to_static.utils import ( from paddle.fluid.dygraph.dygraph_to_static.variable_trans_func import ( create_undefined_var, ) -from paddle.fluid.dygraph.dygraph_to_static.base_transformer import ( +from .base_transformer import ( BaseTransformer, ) diff --git a/python/paddle/fluid/dygraph/dygraph_to_static/decorator_transformer.py b/python/paddle/jit/dy2static/decorator_transformer.py similarity index 96% rename from python/paddle/fluid/dygraph/dygraph_to_static/decorator_transformer.py rename to python/paddle/jit/dy2static/decorator_transformer.py index 55ca1f9d9aca1fd27ee33a4d11dbac5ff2f34e88..f802db72de3bc730c1b14156ad38e264b0eae79d 100644 --- a/python/paddle/fluid/dygraph/dygraph_to_static/decorator_transformer.py +++ b/python/paddle/jit/dy2static/decorator_transformer.py @@ -17,19 +17,17 @@ from paddle.utils import gast from paddle.fluid.dygraph.dygraph_to_static.static_analysis import ( AstNodeWrapper, ) -from paddle.fluid.dygraph.dygraph_to_static.base_transformer import ( +from .base_transformer import ( BaseTransformer, ) from paddle.fluid.dygraph.dygraph_to_static.utils import ( - create_funcDef_node, + RE_PYNAME, + RE_PYMODULE, ast_to_source_code, - is_paddle_api, - Dygraph2StaticException, ) import warnings import re -from paddle.fluid.dygraph.dygraph_to_static.utils import RE_PYNAME, RE_PYMODULE IGNORE_NAMES = [ 'declarative', diff --git a/python/paddle/jit/dy2static/early_return_transformer.py b/python/paddle/jit/dy2static/early_return_transformer.py index 864ca52155d72e49945e05ee531e59b3f2af6c21..53bb2394e80373af240423b2ed48e9bb2ca8fe5b 100644 --- a/python/paddle/jit/dy2static/early_return_transformer.py +++ b/python/paddle/jit/dy2static/early_return_transformer.py @@ -16,7 +16,7 @@ from paddle.utils import gast from paddle.fluid.dygraph.dygraph_to_static.static_analysis import ( AstNodeWrapper, ) -from paddle.fluid.dygraph.dygraph_to_static.base_transformer import ( +from .base_transformer import ( BaseTransformer, ) diff --git a/python/paddle/jit/dy2static/ifelse_transformer.py b/python/paddle/jit/dy2static/ifelse_transformer.py index 86d4f4d4054d6b25ce22087dc140cfb23c041fe8..8bae82c11a16fd61b7309537d28e8b1194107014 100644 --- a/python/paddle/jit/dy2static/ifelse_transformer.py +++ b/python/paddle/jit/dy2static/ifelse_transformer.py @@ -39,7 +39,7 @@ from paddle.fluid.dygraph.dygraph_to_static.utils import ( create_get_args_node, create_set_args_node, ) -from paddle.fluid.dygraph.dygraph_to_static.base_transformer import ( +from .base_transformer import ( BaseTransformer, ) from paddle.fluid.dygraph.dygraph_to_static.utils import ( diff --git a/python/paddle/fluid/dygraph/dygraph_to_static/logical_transformer.py b/python/paddle/jit/dy2static/logical_transformer.py similarity index 98% rename from python/paddle/fluid/dygraph/dygraph_to_static/logical_transformer.py rename to python/paddle/jit/dy2static/logical_transformer.py index 3ad623a8ff08509056811b19baa2124a9f8aa83d..1ab4491d8d9412f79e167095800e7937d1caabd6 100644 --- a/python/paddle/fluid/dygraph/dygraph_to_static/logical_transformer.py +++ b/python/paddle/jit/dy2static/logical_transformer.py @@ -14,7 +14,7 @@ from paddle.utils import gast from paddle.fluid.dygraph.dygraph_to_static.utils import ast_to_source_code -from paddle.fluid.dygraph.dygraph_to_static.base_transformer import ( +from .base_transformer import ( BaseTransformer, ) diff --git a/python/paddle/jit/dy2static/loop_transformer.py b/python/paddle/jit/dy2static/loop_transformer.py index 3d109398c81e7debde039950431c6e8efa3f4a05..7d42638b9e0f6bf9fbc67f232ed045e169a4a744 100644 --- a/python/paddle/jit/dy2static/loop_transformer.py +++ b/python/paddle/jit/dy2static/loop_transformer.py @@ -35,15 +35,12 @@ from paddle.fluid.dygraph.dygraph_to_static.utils import ( FunctionNameLivenessAnalysis, ) from .ifelse_transformer import ARGS_NAME -from paddle.fluid.dygraph.dygraph_to_static.base_transformer import ( +from .base_transformer import ( BaseTransformer, -) -from paddle.fluid.dygraph.dygraph_to_static.base_transformer import ( ForLoopTuplePreTransformer, -) -from paddle.fluid.dygraph.dygraph_to_static.base_transformer import ( ForNodeVisitor, ) + from paddle.fluid.dygraph.dygraph_to_static.utils import ( GetterSetterHelper, create_name_str, diff --git a/python/paddle/fluid/dygraph/dygraph_to_static/print_transformer.py b/python/paddle/jit/dy2static/print_transformer.py similarity index 96% rename from python/paddle/fluid/dygraph/dygraph_to_static/print_transformer.py rename to python/paddle/jit/dy2static/print_transformer.py index fdbd585a71bfb4df93aabbf9f3c08b230f225357..cd4f13f019bc8ff704e75e8abb6d005dad5ef474 100644 --- a/python/paddle/fluid/dygraph/dygraph_to_static/print_transformer.py +++ b/python/paddle/jit/dy2static/print_transformer.py @@ -18,7 +18,7 @@ from paddle.fluid.dygraph.dygraph_to_static.static_analysis import ( AstNodeWrapper, StaticAnalysisVisitor, ) -from paddle.fluid.dygraph.dygraph_to_static.base_transformer import ( +from .base_transformer import ( BaseTransformer, ) diff --git a/python/paddle/jit/dy2static/return_transformer.py b/python/paddle/jit/dy2static/return_transformer.py index cb18dfd33adf39b256abdf900bdcec93476c2995..c8114e078d592e1365dc75dd0d1754a83101e1ec 100644 --- a/python/paddle/jit/dy2static/return_transformer.py +++ b/python/paddle/jit/dy2static/return_transformer.py @@ -20,7 +20,7 @@ from .break_continue_transformer import ( ForToWhileTransformer, ) from paddle.fluid.dygraph.dygraph_to_static.utils import ast_to_source_code -from paddle.fluid.dygraph.dygraph_to_static.base_transformer import ( +from .base_transformer import ( BaseTransformer, ) from paddle.fluid.dygraph.dygraph_to_static.utils import Dygraph2StaticException diff --git a/python/paddle/fluid/dygraph/dygraph_to_static/tensor_shape_transformer.py b/python/paddle/jit/dy2static/tensor_shape_transformer.py similarity index 96% rename from python/paddle/fluid/dygraph/dygraph_to_static/tensor_shape_transformer.py rename to python/paddle/jit/dy2static/tensor_shape_transformer.py index e7a882b28a296dd70448906bd3e03c14770cb00d..9dae08b123eebc02da599602b948c4a8db93b743 100644 --- a/python/paddle/fluid/dygraph/dygraph_to_static/tensor_shape_transformer.py +++ b/python/paddle/jit/dy2static/tensor_shape_transformer.py @@ -18,7 +18,7 @@ from paddle.fluid.dygraph.dygraph_to_static.utils import ast_to_source_code from paddle.fluid.dygraph.dygraph_to_static.static_analysis import ( AstNodeWrapper, ) -from paddle.fluid.dygraph.dygraph_to_static.base_transformer import ( +from .base_transformer import ( BaseTransformer, ) diff --git a/python/paddle/fluid/dygraph/dygraph_to_static/typehint_transformer.py b/python/paddle/jit/dy2static/typehint_transformer.py similarity index 89% rename from python/paddle/fluid/dygraph/dygraph_to_static/typehint_transformer.py rename to python/paddle/jit/dy2static/typehint_transformer.py index 3fddc0bcf58c205d78163075ac784edbb4d9b7be..dd272f76477f47c57ea41cac6991909d90f0c7ef 100644 --- a/python/paddle/fluid/dygraph/dygraph_to_static/typehint_transformer.py +++ b/python/paddle/jit/dy2static/typehint_transformer.py @@ -12,14 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -from paddle.utils import gast -import warnings from paddle.fluid.dygraph.dygraph_to_static.static_analysis import ( AstNodeWrapper, ) -from paddle.fluid.dygraph.dygraph_to_static import utils -from paddle.fluid.dygraph.dygraph_to_static.base_transformer import ( +from .base_transformer import ( BaseTransformer, )