class_docstr: Base class of Crosstalk.
  Please refer to crosstalk unittests for examples of how to exchange/compare values between different toolkits.
class_docstr_tok: ["Base","class","of","Crosstalk",".","Please","refer","to","crosstalk","unittests","for","examples","of","how","to","exchange\/compare","values","between","different","toolkits","."]
docstr: Compare var with name to value in file in working directory
  
  Args:
      name (`str`): Name of the variable to compare
      compare_name (`str`): Compare to file with compare_name if specified
      rtol (`float`): The relative tolerance parameter, as in numpy.isclose()
      atol (`float`): The absolute tolerance parameter, as in numpy.isclose()
      equal_nan (`bool`): Whether to compare NaNs as equal, as in numpy.isclose()
docstr_tok: ["Compare","var","with","name","to","value","in","file","in","working","directory","Args",":","name","(","`","str","`",")",":","Name","of","the","variable","to","compare","compare_name","(","`","str","`",")",":","Compare","to","file","with","compare_name","if","specified","rtol","(","`","float","`",")",":","The","relative","tolerance","parameter",",","as","in","numpy.isclose","(",")","atol","(","`","float","`",")",":","The","absolute","tolerance","parameter",",","as","in","numpy.isclose","(",")","equal_nan","(","`","bool","`",")",":","Whether","to","compare","NaNs","as","equal",",","as","in","numpy.isclose","(",")"]
code: def compare(
      self,
      name,
      compare_name=None,
      rtol=1e-05,
      atol=1e-08,
      equal_nan=False,
  ):
      """
      Compare var with name to value in file in working directory
  
      Args:
          name (`str`): Name of the variable to compare
          compare_name (`str`): Compare to file with compare_name if specified
          rtol (`float`): The relative tolerance parameter, as in numpy.isclose()
          atol (`float`): The absolute tolerance parameter, as in numpy.isclose()
          equal_nan (`bool`): Whether to compare NaNs as equal, as in numpy.isclose()
      """
      var, var_type, attr = self.vars[name]
      raw_value = self.funcs[var_type].getter(var, attr)
      gt_value = self.load_raw_value(
          compare_name if compare_name else name
      )
      if type(raw_value) == np.ndarray:
          if type(gt_value) == np.ndarray:
              return np.isclose(
                  gt_value, raw_value, rtol, atol, equal_nan
              ).all()
          elif type(gt_value) == list:
              return _compare_list_to_ndarray(
                  gt_value, raw_value, rtol, atol, equal_nan
              )
      elif type(raw_value) == list and all(
          [type(x) == np.ndarray for x in raw_value]
      ):
          if (
              type(gt_value) == np.ndarray
          ):  # handle batch axis in ndarray as well as in list
              return _compare_list_to_ndarray(
                  raw_value, gt_value, rtol, atol, equal_nan
              )
          else:
              if (
                  type(gt_value) != list
                  or not all([type(x) == np.ndarray for x in gt_value])
                  or len(gt_value) != len(raw_value)
              ):
                  raise Exception("mismatch length or type")
              return all(
                  [
                      np.isclose(gt, raw, rtol, atol, equal_nan).all()
                      for (gt, raw) in zip(gt_value, raw_value)
                  ]
              )
      elif type(raw_value) == dict:
          if (
              type(gt_value) != dict
              or not all(
                  [type(x) == np.ndarray for x in gt_value.values()]
              )
              or len(gt_value) != len(raw_value)
          ):
              raise Exception("mismatch length or type")
          if gt_value.keys() != raw_value.keys():
              raise Exception("mismatch dict")
          return all(
              [
                  np.isclose(
                      gt_value[w], raw_value[w], rtol, atol, equal_nan
                  ).all()
                  for w in gt_value.keys()
              ]
          )
      else:
          raise Exception(
              "can only compare numpy.ndarray, list of numpy.ndarray or dict of numpy.ndarray"
          )
  
imports: import os
  import pickle
  import numpy
  from collections import namedtuple
label_desc: Use image node_id 10 for calling the Crosstalk obj's underlying member method code with example usage: obj.compare(name, compare_name, rtol, atol, equal_nan) and returns: np, _compare_list_to_ndarray, _compare_list_to_ndarray, all, all