diff --git a/doc/fluid/api/dygraph.rst b/doc/fluid/api/dygraph.rst index 1117ae7fe2e10dea2438cf3700484080524533e3..f7c42e7e3bddb69ad5dd87c8031a53d7320f20ca 100644 --- a/doc/fluid/api/dygraph.rst +++ b/doc/fluid/api/dygraph.rst @@ -16,6 +16,7 @@ fluid.dygraph dygraph/CosineDecay.rst dygraph/DataParallel.rst dygraph/disable_dygraph.rst + dygraph/disable_imperative.rst dygraph/Dropout.rst dygraph/dygraph_to_static_code.rst dygraph/dygraph_to_static_func.rst @@ -23,6 +24,7 @@ fluid.dygraph dygraph/dygraph_to_static_program.rst dygraph/Embedding.rst dygraph/enable_dygraph.rst + dygraph/enable_imperative.rst dygraph/enabled.rst dygraph/ExponentialDecay.rst dygraph/grad.rst diff --git a/doc/fluid/api/dygraph/disable_imperative.rst b/doc/fluid/api/dygraph/disable_imperative.rst new file mode 100644 index 0000000000000000000000000000000000000000..7296a8d0b1eb76b082dda9b8f2f248271f662fc0 --- /dev/null +++ b/doc/fluid/api/dygraph/disable_imperative.rst @@ -0,0 +1,11 @@ +.. 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: + diff --git a/doc/fluid/api/dygraph/enable_imperative.rst b/doc/fluid/api/dygraph/enable_imperative.rst new file mode 100644 index 0000000000000000000000000000000000000000..1815e961341b771cd372c6d14f68acaaa682100f --- /dev/null +++ b/doc/fluid/api/dygraph/enable_imperative.rst @@ -0,0 +1,11 @@ +.. 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: + diff --git a/doc/fluid/api/fluid.rst b/doc/fluid/api/fluid.rst index 1440d541e1d7abe78aa11609c33ceda0ce8a4f93..e99bc1fb8bd30d4a05843921bfaed8d8fb995866 100644 --- a/doc/fluid/api/fluid.rst +++ b/doc/fluid/api/fluid.rst @@ -23,10 +23,12 @@ fluid fluid/default_startup_program.rst fluid/device_guard.rst fluid/disable_dygraph.rst + fluid/disable_imperative.rst fluid/DistributeTranspiler.rst fluid/DistributeTranspilerConfig.rst fluid/embedding.rst fluid/enable_dygraph.rst + fluid/enable_imperative.rst fluid/ExecutionStrategy.rst fluid/Executor.rst fluid/get_flags.rst diff --git a/doc/fluid/api/fluid/disable_imperative.rst b/doc/fluid/api/fluid/disable_imperative.rst new file mode 100644 index 0000000000000000000000000000000000000000..fc5655bf19870f3b44b8cc2af6fa16cd4db16efb --- /dev/null +++ b/doc/fluid/api/fluid/disable_imperative.rst @@ -0,0 +1,11 @@ +.. 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: + diff --git a/doc/fluid/api/fluid/enable_imperative.rst b/doc/fluid/api/fluid/enable_imperative.rst new file mode 100644 index 0000000000000000000000000000000000000000..4fcd0dd2000e281ac0ce6eee66e9150baf1db46c --- /dev/null +++ b/doc/fluid/api/fluid/enable_imperative.rst @@ -0,0 +1,11 @@ +.. 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: + diff --git a/doc/fluid/api_cn/fluid_cn.rst b/doc/fluid/api_cn/fluid_cn.rst index 351d173a4e259df1ac64d78992dd2f2a3c5390c3..b1b825a280c229c1ba70499fc8885c0c1aa70350 100755 --- a/doc/fluid/api_cn/fluid_cn.rst +++ b/doc/fluid/api_cn/fluid_cn.rst @@ -24,11 +24,13 @@ fluid fluid_cn/default_main_program_cn.rst fluid_cn/default_startup_program_cn.rst fluid_cn/disable_dygraph_cn.rst + fluid_cn/disable_imperative_cn.rst fluid_cn/device_guard_cn.rst fluid_cn/DistributeTranspiler_cn.rst fluid_cn/DistributeTranspilerConfig_cn.rst fluid_cn/embedding_cn.rst fluid_cn/enable_dygraph_cn.rst + fluid_cn/enable_imperative_cn.rst fluid_cn/ExecutionStrategy_cn.rst fluid_cn/Executor_cn.rst fluid_cn/get_flags_cn.rst diff --git a/doc/fluid/api_cn/fluid_cn/disable_imperative_cn.rst b/doc/fluid/api_cn/fluid_cn/disable_imperative_cn.rst new file mode 100644 index 0000000000000000000000000000000000000000..9bb289d295d75d2a549c0f9ba3ee5e0876c1b98c --- /dev/null +++ b/doc/fluid/api_cn/fluid_cn/disable_imperative_cn.rst @@ -0,0 +1,23 @@ +.. _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 diff --git a/doc/fluid/api_cn/fluid_cn/enable_imperative_cn.rst b/doc/fluid/api_cn/fluid_cn/enable_imperative_cn.rst new file mode 100644 index 0000000000000000000000000000000000000000..a9021c93286d6110678b3ad2145a80bf21767334 --- /dev/null +++ b/doc/fluid/api_cn/fluid_cn/enable_imperative_cn.rst @@ -0,0 +1,26 @@ +.. _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]] +