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 c45ac1a1fd49f423fe73ea921564db28facdf424..d64ba599247b14ced8caea52be983c217c5bb501 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]) -