isfinite_cn.rst 643 字节
Newer Older
H
Hao Wang 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
.. _cn_api_fluid_layers_isfinite:

isfinite
-------------------------------

.. py:function:: paddle.fluid.layers.isfinite(x)

测试x是否包含无穷大/NAN值,如果所有元素都是有穷数,返回Ture,否则返回False

参数:
  - **x(variable)** - 用于被检查的Tensor/LoDTensor

返回: Variable: tensor变量存储输出值,包含一个bool型数值

返回类型:Variable

**代码示例**:

.. code-block:: python

    import paddle.fluid as fluid
    var = fluid.layers.data(name="data",
                            shape=(4, 6),
                            dtype="float32")
    out = fluid.layers.isfinite(v)