Replaces NaN, positive infinity, and negative infinity values in input tensor.
Args:
x (Tensor): An N-D Tensor, the data type is float32, float64.
nan (float, optional): the value to replace NaNs with. Default is 0.
posinf (float, optional): if a Number, the value to replace positive infinity values with. If None, positive infinity values are replaced with the greatest finite value representable by input’s dtype. Default is None.
neginf (float, optional): if a Number, the value to replace negative infinity values with. If None, negative infinity values are replaced with the lowest finite value representable by input’s dtype. Default is None.
name (str, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.
Returns:
Tensor: Results of nan_to_num operation input Tensor ``x``.
Examples:
.. code-block:: python
import paddle
x = paddle.to_tensor([float('nan'), 0.3, float('+inf'), float('-inf')], dtype='float32')