Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions python/paddle/base/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1257,11 +1257,10 @@ class Executor:

Examples:

.. code-block:: python
.. code-block:: pycon

>>> import paddle
>>> import numpy
>>> import os

>>> # Executor is only used in static graph mode
>>> paddle.enable_static()
Expand All @@ -1281,21 +1280,13 @@ class Executor:
... hidden = paddle.static.nn.fc(data, 10)
... loss = paddle.mean(hidden)
... paddle.optimizer.SGD(learning_rate=0.01).minimize(loss)
...
>>> # Run the startup program once and only once.
>>> # Not need to optimize/compile the startup program.
>>> exe.run(startup_program)

>>> # Run the main program directly without compile.
>>> # Run the main program.
>>> x = numpy.random.random(size=(10, 1)).astype('float32')
>>> loss_data, = exe.run(train_program, feed={"X": x}, fetch_list=[loss.name])

>>> # Or, compiled the program and run. See `CompiledProgram`
>>> # for more details.
>>> compiled_prog = paddle.static.CompiledProgram(
... train_program)
>>> loss_data, = exe.run(compiled_prog, feed={"X": x}, fetch_list=[loss.name])

>>> (loss_data,) = exe.run(train_program, feed={"X": x}, fetch_list=[loss])
"""

place: _Place
Expand Down
2 changes: 1 addition & 1 deletion python/unittest_py/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ parameterized
wandb>=0.17.2 ; python_version<"3.12"
xlsxwriter==3.0.9
xdoctest==1.3.0
ubelt==1.3.3 # just for xdoctest
ubelt==1.4.0 # just for xdoctest
mypy==1.18.2
soundfile
apache-tvm-ffi==0.1.5
Expand Down
Loading