Skip to content

Commit d9df488

Browse files
committed
fix tracedLayer sample code
1 parent 541ebe7 commit d9df488

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

python/paddle/fluid/compiler.py

Lines changed: 2 additions & 6 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 paddle.jit.dy2static.program_translator import (
695-
ProgramCache,
696-
)
697694
from paddle.jit.dy2static.program_translator import (
698695
CacheKey,
699-
)
700-
from ..fluid.dygraph.dygraph_to_static import logging_utils
701-
from paddle.jit.dy2static.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/jit/api.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,6 +1568,8 @@ def trace(layer, inputs):
15681568
Examples:
15691569
.. code-block:: python:
15701570
1571+
import os
1572+
os.environ['FLAGS_enable_eager_mode'] = '0'
15711573
import paddle
15721574
15731575
class ExampleLayer(paddle.nn.Layer):
@@ -1618,6 +1620,8 @@ def set_strategy(self, build_strategy=None, exec_strategy=None):
16181620
Examples:
16191621
.. code-block:: python:
16201622
1623+
import os
1624+
os.environ['FLAGS_enable_eager_mode'] = '0'
16211625
import paddle
16221626
16231627
class ExampleLayer(paddle.nn.Layer):
@@ -1722,6 +1726,8 @@ def save_inference_model(self, path, feed=None, fetch=None, **kwargs):
17221726
Examples:
17231727
.. code-block:: python:
17241728
1729+
import os
1730+
os.environ['FLAGS_enable_eager_mode'] = '0'
17251731
import numpy as np
17261732
import paddle
17271733

0 commit comments

Comments
 (0)