From a565aff29a6a327ad0ea36630edbbcd90d415320 Mon Sep 17 00:00:00 2001 From: Wang Huan Date: Sun, 27 Sep 2020 10:40:44 +0000 Subject: [PATCH] modify doc for in_dygraph_mode, test=develop --- python/paddle/fluid/framework.py | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/python/paddle/fluid/framework.py b/python/paddle/fluid/framework.py index 797b32f5d47..8b8f76c656e 100644 --- a/python/paddle/fluid/framework.py +++ b/python/paddle/fluid/framework.py @@ -180,14 +180,12 @@ def require_version(min_version, max_version=None): def in_dygraph_mode(): """ - :alias_main: paddle.in_dygraph_mode - :alias: paddle.in_dygraph_mode - :old_api: paddle.fluid.framework.in_dygraph_mode - This function checks whether the program runs in dynamic graph mode or not. - You can enter dynamic graph mode with :ref:`api_fluid_dygraph_guard` api, - or enable and disable dynamic graph mode with :ref:`api_fluid_dygraph_enable` - and :ref:`api_fluid_dygraph_disable` api . + Starting with paddle2.0, the dynamic graph mode the default mode. + + **Note**: + ``paddle.in_dynamic_mode`` is the alias of ``fluid.in_dygraph_mode``, and + ``paddle.in_dynamic_mode`` is recommended to use. Returns: bool: Whether the program is running in dynamic graph mode. @@ -195,12 +193,11 @@ def in_dygraph_mode(): Examples: .. code-block:: python - import paddle.fluid as fluid + import paddle - fluid.enable_dygraph() # Now we are in dygragh mode - print(fluid.in_dygraph_mode()) # True - fluid.disable_dygraph() - print(fluid.in_dygraph_mode()) # False + print(paddle.in_dynamic_mode()) # True + paddle.enable_static() + print(paddle.in_dynamic_mode()) # False """ return _dygraph_tracer_ is not None -- GitLab