From 1c8280acc5ac62753cb4e744b5c4c5b2bee9d10c Mon Sep 17 00:00:00 2001 From: Chen Long Date: Sat, 12 Sep 2020 18:48:55 +0800 Subject: [PATCH] Fix api bug (#2599) * add_apis_and_fix_alias * fix code bugs --- doc/paddle/api/alias_api_mapping | 7 ++--- .../fluid/dygraph/jit/set_code_level_cn.rst | 31 +++++++++++++++++++ .../fluid/dygraph/jit/set_verbosity_cn.rst | 30 ++++++++++++++++++ 3 files changed, 63 insertions(+), 5 deletions(-) create mode 100644 doc/paddle/api/paddle/fluid/dygraph/jit/set_code_level_cn.rst create mode 100644 doc/paddle/api/paddle/fluid/dygraph/jit/set_verbosity_cn.rst diff --git a/doc/paddle/api/alias_api_mapping b/doc/paddle/api/alias_api_mapping index 1b31aa410..6175c1d6d 100644 --- a/doc/paddle/api/alias_api_mapping +++ b/doc/paddle/api/alias_api_mapping @@ -3,7 +3,6 @@ paddle.fluid.layers.sigmoid_focal_loss paddle.nn.functional.sigmoid_focal_loss,p paddle.fluid.layers.smooth_l1 paddle.nn.functional.smooth_l1,paddle.nn.functional.loss.smooth_l1 paddle.nn.functional.loss.l1_loss paddle.nn.functional.l1_loss paddle.nn.functional.loss.margin_ranking_loss paddle.nn.functional.margin_ranking_loss -paddle.nn.layer.conv paddle.nn.conv paddle.nn.layer.pooling.AdaptiveAvgPool3d paddle.nn.AdaptiveAvgPool3d,paddle.nn.layer.AdaptiveAvgPool3d paddle.nn.functional.common.alpha_dropout paddle.nn.functional.alpha_dropout paddle.nn.functional.activation.logsigmoid paddle.nn.functional.logsigmoid @@ -159,7 +158,6 @@ paddle.nn.layer.conv.ConvTranspose2d paddle.nn.ConvTranspose2d,paddle.nn.layer.C paddle.fluid.dygraph.container.LayerList paddle.nn.LayerList paddle.fluid.compiler.ExecutionStrategy paddle.static.ExecutionStrategy paddle.fluid.layers.ceil paddle.ceil,paddle.tensor.ceil,paddle.tensor.math.ceil -paddle.nn.layer.loss paddle.nn.loss paddle.nn.layer.activation.ReLU paddle.nn.layer.ReLU paddle.tensor.logic.greater_equal paddle.greater_equal,paddle.tensor.greater_equal paddle.nn.layer.pooling.AvgPool2d paddle.nn.AvgPool2d,paddle.nn.layer.AvgPool2d @@ -266,11 +264,11 @@ paddle.fluid.layers.conv2d paddle.static.nn.conv2d paddle.fluid.layers.create_parameter paddle.static.nn.create_parameter paddle.tensor.creation.ones_like paddle.ones_like,paddle.tensor.ones_like paddle.fluid.layers.sums paddle.sums,paddle.tensor.sums,paddle.tensor.math.sums -paddle.nn.functional.rnn.birnn paddle.nn.functional.birnn +paddle.fluid.layers.rnn.birnn paddle.nn.functional.birnn,paddle.nn.functional.rnn.birnn paddle.fluid.dygraph.base.no_grad paddle.framework.no_grad paddle.nn.functional.common.dropout3d paddle.nn.functional.dropout3d paddle.fluid.layers.polygon_box_transform paddle.nn.functional.polygon_box_transform,paddle.nn.functional.extension.polygon_box_transform -paddle.nn.functional.rnn.rnn paddle.nn.functional.rnn +paddle.fluid.layers.rnn.rnn paddle.nn.functional.rnn,paddle.nn.functional.rnn.rnn paddle.tensor.search.sort paddle.sort,paddle.tensor.sort paddle.tensor.logic.equal paddle.equal,paddle.tensor.equal paddle.fluid.layers.swish paddle.nn.functional.swish,paddle.nn.functional.activation.swish @@ -309,7 +307,6 @@ paddle.fluid.clip.GradientClipByNorm paddle.nn.GradientClipByNorm,paddle.nn.clip paddle.tensor.creation.triu paddle.triu,paddle.tensor.triu paddle.fluid.layers.reduce_all paddle.reduce_all,paddle.tensor.reduce_all,paddle.tensor.logic.reduce_all paddle.fluid.layers.rpn_target_assign paddle.nn.functional.rpn_target_assign,paddle.nn.functional.extension.rpn_target_assign -paddle.nn.layer.vision paddle.nn.vision paddle.fluid.layers.reduce_max paddle.reduce_max,paddle.tensor.reduce_max,paddle.tensor.math.reduce_max paddle.tensor.random.randperm paddle.randperm,paddle.tensor.randperm paddle.fluid.layers.deformable_conv paddle.static.nn.deformable_conv diff --git a/doc/paddle/api/paddle/fluid/dygraph/jit/set_code_level_cn.rst b/doc/paddle/api/paddle/fluid/dygraph/jit/set_code_level_cn.rst new file mode 100644 index 000000000..9de1751db --- /dev/null +++ b/doc/paddle/api/paddle/fluid/dygraph/jit/set_code_level_cn.rst @@ -0,0 +1,31 @@ +.. _cn_api_fluid_dygraph_jit_set_code_level: + +set_code_level +----------------- + +.. py:function:: paddle.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 paddle + import os + 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/paddle/api/paddle/fluid/dygraph/jit/set_verbosity_cn.rst b/doc/paddle/api/paddle/fluid/dygraph/jit/set_verbosity_cn.rst new file mode 100644 index 000000000..5cfda6a85 --- /dev/null +++ b/doc/paddle/api/paddle/fluid/dygraph/jit/set_verbosity_cn.rst @@ -0,0 +1,30 @@ +.. _cn_api_fluid_dygraph_jit_set_verbosity: + +set_verbosity +----------------- + +.. py:function:: paddle.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` -- GitLab