From 8d4bd1ac6e0dd9ec89adecef83fdaffde34ee54d Mon Sep 17 00:00:00 2001 From: liym27 <33742067+liym27@users.noreply.github.com> Date: Sat, 12 Sep 2020 22:19:32 +0800 Subject: [PATCH] [Dy2Stat-API] Add Chinese doc of api set_verbosity and set_code_level (#2593) --- doc/fluid/api_cn/dygraph_cn/jit_cn.rst | 2 ++ .../dygraph_cn/jit_cn/set_code_level_cn.rst | 34 ++++++++++++++++++ .../dygraph_cn/jit_cn/set_verbosity_cn.rst | 35 +++++++++++++++++++ doc/fluid/api_cn/imperative_cn/jit_cn.rst | 4 ++- .../jit_cn/set_code_level_cn.rst | 5 +++ .../imperative_cn/jit_cn/set_verbosity_cn.rst | 5 +++ 6 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 doc/fluid/api_cn/dygraph_cn/jit_cn/set_code_level_cn.rst create mode 100644 doc/fluid/api_cn/dygraph_cn/jit_cn/set_verbosity_cn.rst create mode 100644 doc/fluid/api_cn/imperative_cn/jit_cn/set_code_level_cn.rst create mode 100644 doc/fluid/api_cn/imperative_cn/jit_cn/set_verbosity_cn.rst diff --git a/doc/fluid/api_cn/dygraph_cn/jit_cn.rst b/doc/fluid/api_cn/dygraph_cn/jit_cn.rst index 4a9b90d5c..6899679ce 100644 --- a/doc/fluid/api_cn/dygraph_cn/jit_cn.rst +++ b/doc/fluid/api_cn/dygraph_cn/jit_cn.rst @@ -6,5 +6,7 @@ jit :maxdepth: 1 jit_cn/save_cn.rst + jit_cn/set_code_level_cn.rst + jit_cn/set_verbosity_cn.rst jit_cn/load_cn.rst jit_cn/SaveLoadConfig_cn.rst diff --git a/doc/fluid/api_cn/dygraph_cn/jit_cn/set_code_level_cn.rst b/doc/fluid/api_cn/dygraph_cn/jit_cn/set_code_level_cn.rst new file mode 100644 index 000000000..73b0830cd --- /dev/null +++ b/doc/fluid/api_cn/dygraph_cn/jit_cn/set_code_level_cn.rst @@ -0,0 +1,34 @@ +.. _cn_api_fluid_dygraph_jit_set_code_level: + +set_code_level +----------------- + +.. py:function:: paddle.fluid.dygraph.jit.set_code_level(level=100) + +设置代码级别,打印该级别 AST Transformer 转化后的代码。 + +有两种方法设置代码级别: + +1. 调用函数 ``set_code_level`` +2. 设置环境变量 ``TRANSLATOR_CODE_LEVEL`` + +.. note:: + 函数 ``set_code_level`` 的优先级高于环境变量 ``TRANSLATOR_CODE_LEVEL``。 + + +参数: + - **level** (int) - 打印的代码级别。默认值为100,这意味着打印的是所有 AST Transformer 转化后的代码。 + +**示例代码** + +.. code-block:: python + + import os + import paddle + + paddle.jit.set_code_level(2) + # It will print the transformed code at level 2, which means to print the code after second transformer, + # as the date of August 28, 2020, it is CastTransformer. + + os.environ['TRANSLATOR_CODE_LEVEL'] = '3' + # The code level is now 3, but it has no effect because it has a lower priority than `set_code_level` diff --git a/doc/fluid/api_cn/dygraph_cn/jit_cn/set_verbosity_cn.rst b/doc/fluid/api_cn/dygraph_cn/jit_cn/set_verbosity_cn.rst new file mode 100644 index 000000000..c185e94e5 --- /dev/null +++ b/doc/fluid/api_cn/dygraph_cn/jit_cn/set_verbosity_cn.rst @@ -0,0 +1,35 @@ +.. _cn_api_fluid_dygraph_jit_set_verbosity: + +set_verbosity +----------------- + +.. py:function:: paddle.fluid.dygraph.jit.set_verbosity(level=0) + +设置动态图转静态图的日志详细级别。 + +有两种方法设置日志详细级别: + +1. 调用函数 ``set_verbosity`` +2. 设置环境变量 ``TRANSLATOR_VERBOSITY`` + +.. note:: + 函数 ``set_verbosity`` 的优先级高于环境变量 ``TRANSLATOR_VERBOSITY``。 + + +参数: + - **level** (int) - 日志详细级别。值越大,表示越详细。默认值为0,表示不显示日志。 + +**示例代码** + +.. code-block:: python + + import os + import paddle + + paddle.jit.set_verbosity(1) + # The verbosity level is now 1 + + os.environ['TRANSLATOR_VERBOSITY'] = '3' + # The verbosity level is now 3, but it has no effect because it has a lower priority than `set_verbosity` + + diff --git a/doc/fluid/api_cn/imperative_cn/jit_cn.rst b/doc/fluid/api_cn/imperative_cn/jit_cn.rst index 491ead2e2..baa8019a5 100644 --- a/doc/fluid/api_cn/imperative_cn/jit_cn.rst +++ b/doc/fluid/api_cn/imperative_cn/jit_cn.rst @@ -6,5 +6,7 @@ jit :maxdepth: 1 jit_cn/save_cn.rst + jit_cn/set_code_level_cn.rst + jit_cn/set_verbosity.rst jit_cn/load_cn.rst - jit_cn/SaveLoadConfig_cn.rst \ No newline at end of file + jit_cn/SaveLoadConfig_cn.rst diff --git a/doc/fluid/api_cn/imperative_cn/jit_cn/set_code_level_cn.rst b/doc/fluid/api_cn/imperative_cn/jit_cn/set_code_level_cn.rst new file mode 100644 index 000000000..e57014212 --- /dev/null +++ b/doc/fluid/api_cn/imperative_cn/jit_cn/set_code_level_cn.rst @@ -0,0 +1,5 @@ +.. _cn_api_imperative_jit_set_code_level: + +set_code_level +------------------------------- +:doc_source: paddle.fluid.dygraph.jit.set_code_level \ No newline at end of file diff --git a/doc/fluid/api_cn/imperative_cn/jit_cn/set_verbosity_cn.rst b/doc/fluid/api_cn/imperative_cn/jit_cn/set_verbosity_cn.rst new file mode 100644 index 000000000..a20b6c67d --- /dev/null +++ b/doc/fluid/api_cn/imperative_cn/jit_cn/set_verbosity_cn.rst @@ -0,0 +1,5 @@ +.. _cn_api_imperative_jit_set_verbosity: + +set_verbosity +------------------------------- +:doc_source: paddle.fluid.dygraph.jit.set_verbosity \ No newline at end of file -- GitLab