Skip to content

Commit ea830d4

Browse files
authored
[Fluid Clean] Migrate program_translate.py/jit.py into paddle.jit dir (#48240)
* [Fluid Clean] Migrate program_translate.py/jit.py into paddle.jit dir
1 parent fd9c91c commit ea830d4

File tree

76 files changed

+179
-191
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+179
-191
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ paddle/fluid/operators/generated_op.cc
7575
paddle/fluid/operators/generated_sparse_op.cc
7676
paddle/phi/ops/compat/generated_sig.cc
7777
paddle/phi/ops/compat/generated_sparse_sig.cc
78+
paddle/phi/api/yaml/parsed_apis/
7879
paddle/fluid/operators/generator/parsed_ops/
7980
paddle/fluid/pybind/tmp_eager_op_function_impl.h
8081
paddle/fluid/pybind/eager_op_function_impl.h

python/paddle/distributed/auto_parallel/helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from paddle.fluid.framework import Parameter
2121
from paddle.fluid.framework import program_guard
2222
from paddle.fluid.executor import global_scope
23-
from paddle.fluid.dygraph.dygraph_to_static.program_translator import (
23+
from paddle.jit.dy2static.program_translator import (
2424
StaticFunction,
2525
)
2626

python/paddle/fluid/compiler.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -691,16 +691,12 @@ def patch_program_cache(ipu_strategy):
691691
Returns:
692692
None
693693
"""
694-
from ..fluid.dygraph.dygraph_to_static.program_translator import (
695-
ProgramCache,
696-
)
697-
from ..fluid.dygraph.dygraph_to_static.program_translator import (
694+
from paddle.jit.dy2static.program_translator import (
698695
CacheKey,
699-
)
700-
from ..fluid.dygraph.dygraph_to_static import logging_utils
701-
from ..fluid.dygraph.dygraph_to_static.program_translator import (
696+
ProgramCache,
702697
MAX_TRACED_PROGRAM_COUNT,
703698
)
699+
from ..fluid.dygraph.dygraph_to_static import logging_utils
704700
from ..fluid.dygraph.dygraph_to_static.partial_program import (
705701
partial_program_from,
706702
)

python/paddle/fluid/dygraph/__init__.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@
3636
from . import learning_rate_scheduler
3737
from .learning_rate_scheduler import *
3838

39-
from . import jit
40-
from .jit import *
4139

4240
from . import io
4341
from .io import *
@@ -46,7 +44,6 @@
4644
from .static_runner import StaticModelRunner
4745

4846
from . import dygraph_to_static
49-
from .dygraph_to_static import ProgramTranslator
5047

5148
from . import rnn
5249
from .rnn import *
@@ -66,8 +63,6 @@
6663
__all__ += parallel.__all__
6764
__all__ += checkpoint.__all__
6865
__all__ += learning_rate_scheduler.__all__
69-
__all__ += jit.__all__
7066
__all__ += io.__all__
7167
__all__ += rnn.__all__
72-
__all__ += ['ProgramTranslator']
7368
__all__ += amp.__all__

python/paddle/fluid/dygraph/checkpoint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import warnings
3232
from .. import core
3333
from .base import guard
34-
from paddle.fluid.dygraph.jit import _SaveLoadConfig
34+
from paddle.jit.api import _SaveLoadConfig
3535
from paddle.fluid.dygraph.io import (
3636
_construct_program_holders,
3737
_construct_params_and_buffers,

python/paddle/fluid/dygraph/dygraph_to_static/__init__.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from . import ast_transformer
16-
from .ast_transformer import *
17-
1815
from . import static_analysis
1916
from .static_analysis import *
2017

@@ -24,9 +21,6 @@
2421
from . import variable_trans_func
2522
from .variable_trans_func import *
2623

27-
from . import program_translator
28-
from .program_translator import *
29-
3024
from . import convert_call_func
3125
from .convert_call_func import *
3226

@@ -36,10 +30,8 @@
3630
from .logging_utils import *
3731

3832
__all__ = []
39-
__all__ += ast_transformer.__all__
4033
__all__ += loop_transformer.__all__
4134
__all__ += static_analysis.__all__
4235
__all__ += variable_trans_func.__all__
43-
__all__ += program_translator.__all__
4436
__all__ += convert_call_func.__all__
4537
__all__ += logging_utils.__all__

python/paddle/fluid/dygraph/dygraph_to_static/convert_call_func.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,7 @@
3636
from paddle.fluid.dygraph.dygraph_to_static.logging_utils import (
3737
TranslatorLogger,
3838
)
39-
from paddle.fluid.dygraph.dygraph_to_static.program_translator import (
40-
StaticFunction,
41-
)
42-
from paddle.fluid.dygraph.dygraph_to_static.program_translator import (
43-
convert_to_static,
44-
)
45-
from paddle.fluid.dygraph.dygraph_to_static.program_translator import (
46-
unwrap_decorators,
47-
)
39+
4840
from paddle.fluid.dygraph.dygraph_to_static.utils import is_paddle_func, unwrap
4941
from paddle.fluid.dygraph.layers import Layer
5042

@@ -185,6 +177,13 @@ def dyfunc(x):
185177
# [1. 1. 1.]]
186178
187179
"""
180+
# NOTE(Aurelius84): Fix it after all files migrating into jit.
181+
from paddle.jit.dy2static.program_translator import (
182+
convert_to_static,
183+
unwrap_decorators,
184+
StaticFunction,
185+
)
186+
188187
translator_logger.log(
189188
1, "Convert callable object: convert {}.".format(func)
190189
)

python/paddle/fluid/dygraph/static_runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from paddle.fluid.dygraph.jit import _SaveLoadConfig
15+
from paddle.jit.api import _SaveLoadConfig
1616
from paddle.fluid.dygraph.io import TranslatedLayer
1717

1818

python/paddle/fluid/tests/unittests/dygraph_to_static/bert_dygraph_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import paddle
1616
import paddle.fluid as fluid
1717
from paddle.fluid.dygraph import Embedding, Layer, Linear
18-
from paddle.fluid.dygraph.jit import declarative
18+
from paddle.jit.api import declarative
1919

2020
from transformer_dygraph_model import MultiHeadAttention, PrePostProcessLayer
2121

python/paddle/fluid/tests/unittests/dygraph_to_static/seq2seq_dygraph_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from paddle.fluid import layers
2121
from paddle.fluid.dygraph import Layer
2222
from paddle.fluid.dygraph.base import to_variable
23-
from paddle.fluid.dygraph.jit import declarative
23+
from paddle.jit.api import declarative
2424
from paddle.fluid.dygraph.nn import Embedding
2525
from seq2seq_utils import Seq2SeqModelHyperParams as args
2626

0 commit comments

Comments
 (0)