From 0bca87f98a10e6e0cdbe1c429c5e02acb9feaef4 Mon Sep 17 00:00:00 2001 From: danleifeng Date: Sun, 27 Sep 2020 09:07:58 +0000 Subject: [PATCH] change Variable into Tensor;test=develop --- .../api/paddle/fluid/layers/is_empty_cn.rst | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/doc/paddle/api/paddle/fluid/layers/is_empty_cn.rst b/doc/paddle/api/paddle/fluid/layers/is_empty_cn.rst index c45ac1a1f..d64ba5992 100644 --- a/doc/paddle/api/paddle/fluid/layers/is_empty_cn.rst +++ b/doc/paddle/api/paddle/fluid/layers/is_empty_cn.rst @@ -11,16 +11,32 @@ is_empty 测试变量是否为空 参数: - - **x** (Variable)-测试的变量 + - **x** (Tensor)-测试的变量 - **name** (str,可选)- 输出的名字。默认值为None。该参数供开发人员打印调试信息时使用,具体用法请参见 :ref:`api_guide_Name` 。 返回:布尔类型的标量。如果变量x为空则值为真 -返回类型:Variable +返回类型:Tensor **代码示例**: +.. code-block:: python + + # dygraph_mode + import paddle + + input = paddle.rand(shape=[4, 32, 32], dtype='float32') + res = paddle.is_empty(x=input) + print("res:", res) + # ('res:', Tensor: eager_tmp_1 + # - place: CPUPlace + # - shape: [1] + # - layout: NCHW + # - dtype: bool + # - data: [0]) + + .. code-block:: python # static mode @@ -38,19 +54,4 @@ is_empty # ('out:', [array([False])]) -.. code-block:: python - - # dygraph_mode - import paddle - - input = paddle.rand(shape=[4, 32, 32], dtype='float32') - res = paddle.is_empty(x=input) - print("res:", res) - # ('res:', Tensor: eager_tmp_1 - # - place: CPUPlace - # - shape: [1] - # - layout: NCHW - # - dtype: bool - # - data: [0]) - -- GitLab