未验证 提交 26f76cde 编写于 作者: H hong 提交者: GitHub

add fluid enable_imperative doc; test=develop (#2099)

上级 eabb8ddb
...@@ -16,6 +16,7 @@ fluid.dygraph ...@@ -16,6 +16,7 @@ fluid.dygraph
dygraph/CosineDecay.rst dygraph/CosineDecay.rst
dygraph/DataParallel.rst dygraph/DataParallel.rst
dygraph/disable_dygraph.rst dygraph/disable_dygraph.rst
dygraph/disable_imperative.rst
dygraph/Dropout.rst dygraph/Dropout.rst
dygraph/dygraph_to_static_code.rst dygraph/dygraph_to_static_code.rst
dygraph/dygraph_to_static_func.rst dygraph/dygraph_to_static_func.rst
...@@ -23,6 +24,7 @@ fluid.dygraph ...@@ -23,6 +24,7 @@ fluid.dygraph
dygraph/dygraph_to_static_program.rst dygraph/dygraph_to_static_program.rst
dygraph/Embedding.rst dygraph/Embedding.rst
dygraph/enable_dygraph.rst dygraph/enable_dygraph.rst
dygraph/enable_imperative.rst
dygraph/enabled.rst dygraph/enabled.rst
dygraph/ExponentialDecay.rst dygraph/ExponentialDecay.rst
dygraph/grad.rst dygraph/grad.rst
......
.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}`
!DO NOT EDIT THIS FILE MANUALLY!
.. _api_fluid_dygraph_disable_imperative:
disable_imperative
------------------
.. autofunction:: paddle.fluid.dygraph.disable_imperative
:noindex:
.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}`
!DO NOT EDIT THIS FILE MANUALLY!
.. _api_fluid_dygraph_enable_imperative:
enable_imperative
-----------------
.. autofunction:: paddle.fluid.dygraph.enable_imperative
:noindex:
...@@ -23,10 +23,12 @@ fluid ...@@ -23,10 +23,12 @@ fluid
fluid/default_startup_program.rst fluid/default_startup_program.rst
fluid/device_guard.rst fluid/device_guard.rst
fluid/disable_dygraph.rst fluid/disable_dygraph.rst
fluid/disable_imperative.rst
fluid/DistributeTranspiler.rst fluid/DistributeTranspiler.rst
fluid/DistributeTranspilerConfig.rst fluid/DistributeTranspilerConfig.rst
fluid/embedding.rst fluid/embedding.rst
fluid/enable_dygraph.rst fluid/enable_dygraph.rst
fluid/enable_imperative.rst
fluid/ExecutionStrategy.rst fluid/ExecutionStrategy.rst
fluid/Executor.rst fluid/Executor.rst
fluid/get_flags.rst fluid/get_flags.rst
......
.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}`
!DO NOT EDIT THIS FILE MANUALLY!
.. _api_fluid_disable_imperative:
disable_imperative
------------------
.. autofunction:: paddle.fluid.disable_imperative
:noindex:
.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}`
!DO NOT EDIT THIS FILE MANUALLY!
.. _api_fluid_enable_imperative:
enable_imperative
-----------------
.. autofunction:: paddle.fluid.enable_imperative
:noindex:
...@@ -24,11 +24,13 @@ fluid ...@@ -24,11 +24,13 @@ fluid
fluid_cn/default_main_program_cn.rst fluid_cn/default_main_program_cn.rst
fluid_cn/default_startup_program_cn.rst fluid_cn/default_startup_program_cn.rst
fluid_cn/disable_dygraph_cn.rst fluid_cn/disable_dygraph_cn.rst
fluid_cn/disable_imperative_cn.rst
fluid_cn/device_guard_cn.rst fluid_cn/device_guard_cn.rst
fluid_cn/DistributeTranspiler_cn.rst fluid_cn/DistributeTranspiler_cn.rst
fluid_cn/DistributeTranspilerConfig_cn.rst fluid_cn/DistributeTranspilerConfig_cn.rst
fluid_cn/embedding_cn.rst fluid_cn/embedding_cn.rst
fluid_cn/enable_dygraph_cn.rst fluid_cn/enable_dygraph_cn.rst
fluid_cn/enable_imperative_cn.rst
fluid_cn/ExecutionStrategy_cn.rst fluid_cn/ExecutionStrategy_cn.rst
fluid_cn/Executor_cn.rst fluid_cn/Executor_cn.rst
fluid_cn/get_flags_cn.rst fluid_cn/get_flags_cn.rst
......
.. _cn_api_fluid_disable_imperative:
disable_imperative
-------------------------------
.. py:function:: paddle.fluid.disable_imperative()
该接口退出动态图模式。
返回:无
**示例代码**
.. code-block:: python
import paddle.fluid as fluid
fluid.enable_imperative() # Now we are in imperative mode
x = fluid.layers.ones( (2, 2), "float32")
y = fluid.layers.zeros( (2, 2), "float32")
z = x + y
print( z.numpy() ) #[[1, 1], [1, 1]]
fluid.disable_imperative() # Now we are in declarative mode
.. _cn_api_fluid_enable_imperative:
enable_imperative
-------------------------------
.. py:function:: paddle.fluid.enable_imperative(place=None)
该接口打开动态图模式。
参数:
- **place** (fluid.CPUPlace 或 fluid.CUDAPlace,可选) - 执行动态图的设备。若为None,则设备根据paddle的编译方式决定。默认值为 ``None``。
返回:无
**示例代码**
.. code-block:: python
import paddle.fluid as fluid
fluid.enable_imperative() # Now we are in imperative mode
x = fluid.layers.ones( (2, 2), "float32")
y = fluid.layers.zeros( (2, 2), "float32")
z = x + y
print( z.numpy() ) #[[1, 1], [1, 1]]
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册