code: def is_close(expected, actual, atol=1e-04, rtol=1e-05):
      """
      expected, actual: np.array or python primitive (scalar)
      rtol: relative tolerance. See numpy.isclose.
      """
  
      close = np.isclose(expected, actual, atol=atol, rtol=rtol)
      if not np.all(close):
          diff = expected - actual
          num_not_close = np.sum(~close)
          msg = "Values differ by L1 norm: {}. Num entries not close: {}/{}"
          logging.error(
              msg.format(
                  np.sum(np.abs(diff)), num_not_close, expected.size
              )
          )
          if num_not_close < 30:
              logging.error("Differing entries:")
              logging.error("Expected: {}".format(expected[~close]))
              logging.error("Actual: {}".format(actual[~close]))
              logging.error("Delta: {}".format(diff[~close]))
          return False
      return True
  
imports: import logging
  import numpy
  import copy
  import coremltools
  from coremltools import converters
  from coremltools.converters.mil import converter
  from coremltools.converters.mil.mil import Program, Function
  from coremltools.converters.mil.mil.passes.pass_registry import PASS_REGISTRY
  from coremltools._deps import _IS_MACOS
label_desc: Use image node_id 9 for calling a global function with example usage: is_close(expected, actual, atol, rtol) and returns: True, False