未验证 提交 41da96c8 编写于 作者: A Aurelius84 提交者: GitHub

[Fluid clean]Migrate base/call/print et.al transformer into paddle.jit (#48513)

* [Fluid clean]Migrate base/call/print et.al transformer into paddle.jit

* fix phi kernel

* Revert "fix phi kernel"

This reverts commit eff8891c7efda6e49799edbcaef2ca50379d50ef.
上级 16562a9d
...@@ -21,7 +21,8 @@ import numpy as np ...@@ -21,7 +21,8 @@ import numpy as np
import paddle import paddle
import paddle.fluid as fluid 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, cmpop_node_to_str,
) )
from paddle.jit import ProgramTranslator from paddle.jit import ProgramTranslator
......
...@@ -18,7 +18,7 @@ from paddle.fluid.dygraph.dygraph_to_static.static_analysis import ( ...@@ -18,7 +18,7 @@ from paddle.fluid.dygraph.dygraph_to_static.static_analysis import (
AstNodeWrapper, AstNodeWrapper,
) )
from paddle.fluid.dygraph.dygraph_to_static.utils import ast_to_source_code 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, BaseTransformer,
) )
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
# See details in https://github.com/serge-sans-paille/gast/ # See details in https://github.com/serge-sans-paille/gast/
import os import os
from paddle.fluid.dygraph.dygraph_to_static.base_transformer import ( from .base_transformer import (
BaseTransformer, BaseTransformer,
) )
from .early_return_transformer import ( from .early_return_transformer import (
...@@ -27,47 +27,47 @@ from .early_return_transformer import ( ...@@ -27,47 +27,47 @@ from .early_return_transformer import (
from .assert_transformer import ( from .assert_transformer import (
AssertTransformer, AssertTransformer,
) )
from paddle.fluid.dygraph.dygraph_to_static.basic_api_transformer import ( from .basic_api_transformer import (
BasicApiTransformer, BasicApiTransformer,
) )
from .break_continue_transformer import ( from .break_continue_transformer import (
BreakContinueTransformer, BreakContinueTransformer,
BreakTransformOptimizer, BreakTransformOptimizer,
) )
from paddle.fluid.dygraph.dygraph_to_static.call_transformer import ( from .call_transformer import (
CallTransformer, CallTransformer,
) )
from paddle.fluid.dygraph.dygraph_to_static.cast_transformer import ( from .cast_transformer import (
CastTransformer, CastTransformer,
) )
from paddle.fluid.dygraph.dygraph_to_static.typehint_transformer import ( from .typehint_transformer import (
TypeHintTransformer, TypeHintTransformer,
) )
from .ifelse_transformer import ( from .ifelse_transformer import (
IfElseTransformer, IfElseTransformer,
) )
from paddle.fluid.dygraph.dygraph_to_static.logical_transformer import ( from .logical_transformer import (
LogicalTransformer, LogicalTransformer,
) )
from .loop_transformer import ( from .loop_transformer import (
LoopTransformer, LoopTransformer,
) )
from paddle.fluid.dygraph.dygraph_to_static.print_transformer import ( from .print_transformer import (
PrintTransformer, PrintTransformer,
) )
from .return_transformer import ( from .return_transformer import (
ReturnTransformer, ReturnTransformer,
) )
from paddle.fluid.dygraph.dygraph_to_static.create_variable_transformer import ( from .create_variable_transformer import (
CreateVariableTransformer, CreateVariableTransformer,
) )
from paddle.fluid.dygraph.dygraph_to_static.static_analysis import ( from paddle.fluid.dygraph.dygraph_to_static.static_analysis import (
StaticAnalysisVisitor, StaticAnalysisVisitor,
) )
from paddle.fluid.dygraph.dygraph_to_static.tensor_shape_transformer import ( from .tensor_shape_transformer import (
TensorShapeTransformer, TensorShapeTransformer,
) )
from paddle.fluid.dygraph.dygraph_to_static.decorator_transformer import ( from .decorator_transformer import (
DecoratorTransformer, DecoratorTransformer,
) )
......
...@@ -14,25 +14,17 @@ ...@@ -14,25 +14,17 @@
from paddle.utils import gast from paddle.utils import gast
from paddle.fluid import unique_name 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 ( 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, FOR_ITER_VAR_NAME_PREFIX,
)
from paddle.fluid.dygraph.dygraph_to_static.utils import (
FOR_ITER_ZIP_TO_LIST_PREFIX, 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, FOR_ITER_ITERATOR_PREFIX,
create_assign_node,
ast_to_source_code,
get_attribute_full_name,
) )
......
...@@ -19,7 +19,7 @@ from paddle.fluid.dygraph.dygraph_to_static.static_analysis import ( ...@@ -19,7 +19,7 @@ from paddle.fluid.dygraph.dygraph_to_static.static_analysis import (
AstNodeWrapper, AstNodeWrapper,
) )
from paddle.fluid.dygraph.dygraph_to_static import utils from paddle.fluid.dygraph.dygraph_to_static import utils
from paddle.fluid.dygraph.dygraph_to_static.base_transformer import ( from .base_transformer import (
BaseTransformer, BaseTransformer,
) )
from paddle.fluid.dygraph.dygraph_to_static.utils import ast_to_source_code from paddle.fluid.dygraph.dygraph_to_static.utils import ast_to_source_code
......
...@@ -20,10 +20,10 @@ from paddle.fluid.dygraph.dygraph_to_static.utils import BaseNodeVisitor ...@@ -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 ( from paddle.fluid.dygraph.dygraph_to_static.variable_trans_func import (
create_bool_node, create_bool_node,
) )
from paddle.fluid.dygraph.dygraph_to_static.base_transformer import ( from .base_transformer import (
BaseTransformer, BaseTransformer,
) )
from paddle.fluid.dygraph.dygraph_to_static.base_transformer import ( from .base_transformer import (
ForNodeVisitor, ForNodeVisitor,
) )
......
...@@ -19,7 +19,7 @@ from paddle.fluid.dygraph.dygraph_to_static.static_analysis import ( ...@@ -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 ast_to_source_code
from paddle.fluid.dygraph.dygraph_to_static.utils import is_paddle_api 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, BaseTransformer,
) )
......
...@@ -18,7 +18,7 @@ from paddle.fluid.dygraph.dygraph_to_static.static_analysis import ( ...@@ -18,7 +18,7 @@ from paddle.fluid.dygraph.dygraph_to_static.static_analysis import (
AstNodeWrapper, AstNodeWrapper,
) )
from paddle.fluid.dygraph.dygraph_to_static.utils import ast_to_source_code 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, BaseTransformer,
) )
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from paddle.utils import gast
from paddle.fluid.dygraph.dygraph_to_static.static_analysis import ( from paddle.fluid.dygraph.dygraph_to_static.static_analysis import (
AstNodeWrapper, AstNodeWrapper,
) )
...@@ -22,7 +21,7 @@ from paddle.fluid.dygraph.dygraph_to_static.utils import ( ...@@ -22,7 +21,7 @@ from paddle.fluid.dygraph.dygraph_to_static.utils import (
from paddle.fluid.dygraph.dygraph_to_static.variable_trans_func import ( from paddle.fluid.dygraph.dygraph_to_static.variable_trans_func import (
create_undefined_var, create_undefined_var,
) )
from paddle.fluid.dygraph.dygraph_to_static.base_transformer import ( from .base_transformer import (
BaseTransformer, BaseTransformer,
) )
......
...@@ -17,19 +17,17 @@ from paddle.utils import gast ...@@ -17,19 +17,17 @@ from paddle.utils import gast
from paddle.fluid.dygraph.dygraph_to_static.static_analysis import ( from paddle.fluid.dygraph.dygraph_to_static.static_analysis import (
AstNodeWrapper, AstNodeWrapper,
) )
from paddle.fluid.dygraph.dygraph_to_static.base_transformer import ( from .base_transformer import (
BaseTransformer, BaseTransformer,
) )
from paddle.fluid.dygraph.dygraph_to_static.utils import ( from paddle.fluid.dygraph.dygraph_to_static.utils import (
create_funcDef_node, RE_PYNAME,
RE_PYMODULE,
ast_to_source_code, ast_to_source_code,
is_paddle_api,
Dygraph2StaticException,
) )
import warnings import warnings
import re import re
from paddle.fluid.dygraph.dygraph_to_static.utils import RE_PYNAME, RE_PYMODULE
IGNORE_NAMES = [ IGNORE_NAMES = [
'declarative', 'declarative',
......
...@@ -16,7 +16,7 @@ from paddle.utils import gast ...@@ -16,7 +16,7 @@ from paddle.utils import gast
from paddle.fluid.dygraph.dygraph_to_static.static_analysis import ( from paddle.fluid.dygraph.dygraph_to_static.static_analysis import (
AstNodeWrapper, AstNodeWrapper,
) )
from paddle.fluid.dygraph.dygraph_to_static.base_transformer import ( from .base_transformer import (
BaseTransformer, BaseTransformer,
) )
......
...@@ -39,7 +39,7 @@ from paddle.fluid.dygraph.dygraph_to_static.utils import ( ...@@ -39,7 +39,7 @@ from paddle.fluid.dygraph.dygraph_to_static.utils import (
create_get_args_node, create_get_args_node,
create_set_args_node, create_set_args_node,
) )
from paddle.fluid.dygraph.dygraph_to_static.base_transformer import ( from .base_transformer import (
BaseTransformer, BaseTransformer,
) )
from paddle.fluid.dygraph.dygraph_to_static.utils import ( from paddle.fluid.dygraph.dygraph_to_static.utils import (
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
from paddle.utils import gast 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.utils import ast_to_source_code
from paddle.fluid.dygraph.dygraph_to_static.base_transformer import ( from .base_transformer import (
BaseTransformer, BaseTransformer,
) )
......
...@@ -35,15 +35,12 @@ from paddle.fluid.dygraph.dygraph_to_static.utils import ( ...@@ -35,15 +35,12 @@ from paddle.fluid.dygraph.dygraph_to_static.utils import (
FunctionNameLivenessAnalysis, FunctionNameLivenessAnalysis,
) )
from .ifelse_transformer import ARGS_NAME from .ifelse_transformer import ARGS_NAME
from paddle.fluid.dygraph.dygraph_to_static.base_transformer import ( from .base_transformer import (
BaseTransformer, BaseTransformer,
)
from paddle.fluid.dygraph.dygraph_to_static.base_transformer import (
ForLoopTuplePreTransformer, ForLoopTuplePreTransformer,
)
from paddle.fluid.dygraph.dygraph_to_static.base_transformer import (
ForNodeVisitor, ForNodeVisitor,
) )
from paddle.fluid.dygraph.dygraph_to_static.utils import ( from paddle.fluid.dygraph.dygraph_to_static.utils import (
GetterSetterHelper, GetterSetterHelper,
create_name_str, create_name_str,
......
...@@ -18,7 +18,7 @@ from paddle.fluid.dygraph.dygraph_to_static.static_analysis import ( ...@@ -18,7 +18,7 @@ from paddle.fluid.dygraph.dygraph_to_static.static_analysis import (
AstNodeWrapper, AstNodeWrapper,
StaticAnalysisVisitor, StaticAnalysisVisitor,
) )
from paddle.fluid.dygraph.dygraph_to_static.base_transformer import ( from .base_transformer import (
BaseTransformer, BaseTransformer,
) )
......
...@@ -20,7 +20,7 @@ from .break_continue_transformer import ( ...@@ -20,7 +20,7 @@ from .break_continue_transformer import (
ForToWhileTransformer, ForToWhileTransformer,
) )
from paddle.fluid.dygraph.dygraph_to_static.utils import ast_to_source_code 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, BaseTransformer,
) )
from paddle.fluid.dygraph.dygraph_to_static.utils import Dygraph2StaticException from paddle.fluid.dygraph.dygraph_to_static.utils import Dygraph2StaticException
......
...@@ -18,7 +18,7 @@ from paddle.fluid.dygraph.dygraph_to_static.utils import ast_to_source_code ...@@ -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 ( from paddle.fluid.dygraph.dygraph_to_static.static_analysis import (
AstNodeWrapper, AstNodeWrapper,
) )
from paddle.fluid.dygraph.dygraph_to_static.base_transformer import ( from .base_transformer import (
BaseTransformer, BaseTransformer,
) )
......
...@@ -12,14 +12,11 @@ ...@@ -12,14 +12,11 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from paddle.utils import gast
import warnings
from paddle.fluid.dygraph.dygraph_to_static.static_analysis import ( from paddle.fluid.dygraph.dygraph_to_static.static_analysis import (
AstNodeWrapper, AstNodeWrapper,
) )
from paddle.fluid.dygraph.dygraph_to_static import utils from .base_transformer import (
from paddle.fluid.dygraph.dygraph_to_static.base_transformer import (
BaseTransformer, BaseTransformer,
) )
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册