parameters: (a, b, rtol=1e-05, atol=1e-08, equal_nan=False)
return_statement: return res
docstring: Returns a boolean tensor where two tensors are element-wise equal within a tolerance.
  
      The tolerance values are positive, typically very small numbers. The relative
      difference (:math:`rtol * abs(b)`) and the absolute difference `atol` are added together
      to compare against the absolute difference between `a` and `b`.
  
      Note:
          For finite values, isclose uses the following equation to test whether two
          floating point values are equivalent.
          :math:`absolute(a - b) <= (atol + rtol * absolute(b))`
          On Ascend, input arrays containing inf or NaN are not supported.
  
      Args:
          a (Union[Tensor, list, tuple]): Input first tensor to compare.
          b (Union[Tensor, list, tuple]): Input second tensor to compare.
          rtol (numbers.Number): The relative tolerance parameter (see Note).
          atol (numbers.Number): The absolute tolerance parameter (see Note).
          equal_nan (bool): Whether to compare ``NaN`` as equal. If True, ``NaN`` in
              `a` will be considered equal to ``NaN`` in `b` in the output tensor.
              Default: `False`.
  
      Returns:
          A ``bool`` tensor of where `a` and `b` are equal within the given tolerance.
  
      Raises:
          TypeError: If inputs have types not specified above.
  
      Supported Platforms:
          ``Ascend`` ``GPU`` ``CPU``
  
      Examples:
          >>> a = np.array([0,1,2,float('inf'),float('inf'),float('nan')])
          >>> b = np.array([0,1,-2,float('-inf'),float('inf'),float('nan')])
          >>> print(np.isclose(a, b))
          [ True  True False False  True False]
          >>> print(np.isclose(a, b, equal_nan=True))
          [ True  True False False  True  True]
docstring_summary: Returns a boolean tensor where two tensors are element-wise equal within a tolerance.
docstring_tokens: Returns a boolean tensor where two tensors are element - wise equal within a tolerance .
function: def isclose(a, b, rtol=1e-05, atol=1e-08, equal_nan=False):
      """
      Returns a boolean tensor where two tensors are element-wise equal within a tolerance.
  
      The tolerance values are positive, typically very small numbers. The relative
      difference (:math:`rtol * abs(b)`) and the absolute difference `atol` are added together
      to compare against the absolute difference between `a` and `b`.
  
      Note:
          For finite values, isclose uses the following equation to test whether two
          floating point values are equivalent.
          :math:`absolute(a - b) <= (atol + rtol * absolute(b))`
          On Ascend, input arrays containing inf or NaN are not supported.
  
      Args:
          a (Union[Tensor, list, tuple]): Input first tensor to compare.
          b (Union[Tensor, list, tuple]): Input second tensor to compare.
          rtol (numbers.Number): The relative tolerance parameter (see Note).
          atol (numbers.Number): The absolute tolerance parameter (see Note).
          equal_nan (bool): Whether to compare ``NaN`` as equal. If True, ``NaN`` in
              `a` will be considered equal to ``NaN`` in `b` in the output tensor.
              Default: `False`.
  
      Returns:
          A ``bool`` tensor of where `a` and `b` are equal within the given tolerance.
  
      Raises:
          TypeError: If inputs have types not specified above.
  
      Supported Platforms:
          ``Ascend`` ``GPU`` ``CPU``
  
      Examples:
          >>> a = np.array([0,1,2,float('inf'),float('inf'),float('nan')])
          >>> b = np.array([0,1,-2,float('-inf'),float('inf'),float('nan')])
          >>> print(np.isclose(a, b))
          [ True  True False False  True False]
          >>> print(np.isclose(a, b, equal_nan=True))
          [ True  True False False  True  True]
      """
      a, b = _to_tensor(a, b)
      if not isinstance(rtol, (int, float, bool)) or not isinstance(atol, (int, float, bool)):
          _raise_type_error("rtol and atol are expected to be numbers.")
      if not isinstance(equal_nan, bool):
          _raise_type_error("equal_nan is expected to be bool.")
  
      if _is_shape_empty(a.shape) or _is_shape_empty(b.shape):
          return empty(_infer_out_shape(a.shape, b.shape), dtype=mstype.bool_)
      rtol = _to_tensor(rtol).astype("float32")
      atol = _to_tensor(atol).astype("float32")
      res = absolute(a - b) <= (atol + rtol * absolute(b))
      # infs are treated as equal
      a_posinf = isposinf(a)
      b_posinf = isposinf(b)
      a_neginf = isneginf(a)
      b_neginf = isneginf(b)
      same_inf = F.logical_or(F.logical_and(a_posinf, b_posinf), F.logical_and(a_neginf, b_neginf))
      diff_inf = F.logical_or(F.logical_and(a_posinf, b_neginf), F.logical_and(a_neginf, b_posinf))
      res = F.logical_and(F.logical_or(res, same_inf), F.logical_not(diff_inf))
      both_nan = F.logical_and(_isnan(a), _isnan(b))
      if equal_nan:
          res = F.logical_or(both_nan, res)
      else:
          res = F.logical_and(F.logical_not(both_nan), res)
      return res
function_tokens: def isclose ( a , b , rtol = 1e-05 , atol = 1e-08 , equal_nan = False ) : a , b = _to_tensor ( a , b ) if not isinstance ( rtol , ( int , float , bool ) ) or not isinstance ( atol , ( int , float , bool ) ) : _raise_type_error ( "rtol and atol are expected to be numbers." ) if not isinstance ( equal_nan , bool ) : _raise_type_error ( "equal_nan is expected to be bool." ) if _is_shape_empty ( a . shape ) or _is_shape_empty ( b . shape ) : return empty ( _infer_out_shape ( a . shape , b . shape ) , dtype = mstype . bool_ ) rtol = _to_tensor ( rtol ) . astype ( "float32" ) atol = _to_tensor ( atol ) . astype ( "float32" ) res = absolute ( a - b ) <= ( atol + rtol * absolute ( b ) ) # infs are treated as equal a_posinf = isposinf ( a ) b_posinf = isposinf ( b ) a_neginf = isneginf ( a ) b_neginf = isneginf ( b ) same_inf = F . logical_or ( F . logical_and ( a_posinf , b_posinf ) , F . logical_and ( a_neginf , b_neginf ) ) diff_inf = F . logical_or ( F . logical_and ( a_posinf , b_neginf ) , F . logical_and ( a_neginf , b_posinf ) ) res = F . logical_and ( F . logical_or ( res , same_inf ) , F . logical_not ( diff_inf ) ) both_nan = F . logical_and ( _isnan ( a ) , _isnan ( b ) ) if equal_nan : res = F . logical_or ( both_nan , res ) else : res = F . logical_and ( F . logical_not ( both_nan ) , res ) return res