code: def nan_to_num(x, copy=True, nan=0.0, posinf=None, neginf=None):
      """Replace NaN with zero and infinity with large finite numbers (default
      behaviour) or with the numbers defined by the user using the `nan`,
      `posinf` and/or `neginf` keywords.
  
      .. seealso:: :func:`numpy.nan_to_num`
  
      """
      if not isinstance(x, cupy.ndarray):
          out = cupy.full((), x)
      else:
          out = cupy.empty_like(x) if copy else x
      dtype = out.dtype
      nan = _check_nan_inf(nan, dtype)
      posinf = _check_nan_inf(posinf, dtype, False)
      neginf = _check_nan_inf(neginf, dtype, True)
      return _nan_to_num(x, nan, posinf, neginf, out=out)
  
file_path: cupy/cupy/_math/misc.py
imports: import cupy
  import cupyx.scipy.fft
  from cupy import _core
  from cupy._core import _routines_math
  from cupy._core import fusion
  from cupy.lib import stride_tricks
  import numpy
label_desc: Use image node_id 8 for calling a global function with example usage: nan_to_num(x, copy, nan, posinf, neginf) and returns: _nan_to_num