Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修改COPY-FROM No.18 #54842

Merged
merged 16 commits into from
Jul 5, 2023
16 changes: 8 additions & 8 deletions python/paddle/fluid/framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -1259,7 +1259,7 @@ class Variable(metaclass=VariableMetaClass):
Examples:
In Static Graph Mode:

.. code-block:: python
.. code-block:: python :name: code-example1
enkilee marked this conversation as resolved.
Show resolved Hide resolved

import paddle.fluid as fluid
cur_program = fluid.Program()
Expand All @@ -1270,7 +1270,7 @@ class Variable(metaclass=VariableMetaClass):

In Dygraph Mode:

.. code-block:: python
.. code-block:: python :name: code-example2

import paddle.fluid as fluid
import numpy as np
Expand Down Expand Up @@ -5744,7 +5744,7 @@ def clone(self, for_test=False):
recommend you to use :code:`clone` before using :code:`Opimizer.minimize`.

For Example:
::
.. code-block:: python :name: code-example1

import paddle
import paddle.static as static
Expand Down Expand Up @@ -5777,7 +5777,7 @@ def clone(self, for_test=False):
print Program Descs inorder to make sure you have same print result
after :code:`clone`:

.. code-block:: python
.. code-block:: python :name: code-example2

import paddle

Expand All @@ -5794,7 +5794,7 @@ def print_prog(prog):


1. To clone a test program, the sample code is:
.. code-block:: python
.. code-block:: python :name: code-example3

import paddle
import paddle.static as static
Expand Down Expand Up @@ -5846,7 +5846,7 @@ def print_prog(prog):


2. The clone method can be avoid if you create program for training and program for testing individually.
.. code-block:: python
.. code-block:: python :name: code-example4

import paddle
import paddle.static as static
Expand Down Expand Up @@ -7233,7 +7233,7 @@ def program_guard(main_program, startup_program=None):
Default: None.

Examples:
.. code-block:: python
.. code-block:: python :name: code-example1

import paddle

Expand All @@ -7248,7 +7248,7 @@ def program_guard(main_program, startup_program=None):
to construct either of startup program or main program.

Examples:
.. code-block:: python
.. code-block:: python :name: code-example2

import paddle

Expand Down
2 changes: 1 addition & 1 deletion python/paddle/fluid/layers/math_op_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def astype(self, dtype):
Examples:
In Static Graph Mode:

.. code-block:: python
.. code-block:: python:name :code-example5
import paddle
import paddle.fluid as fluid
paddle.enable_static()
Expand Down
2 changes: 1 addition & 1 deletion python/paddle/static/nn/control_flow.py
enkilee marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ def cond(pred, true_fn=None, false_fn=None, name=None, return_names=None):
regardless of which branch is selected at runtime. This has frequently
surprised users who expected a lazy semantics. For example:

.. code-block:: python
.. code-block:: python :name: code-example1

import paddle

Expand Down