code: def _compare_list_to_ndarray(
      list_value, ndarray_value, rtol, atol, equal_nan
  ):
      if ndarray_value.shape[0] != len(list_value):
          raise Exception("mismatch batch size")
      if ndarray_value.shape[2:] != list_value[0].shape[1:]:
          raise Exception(
              "mismatch sample shape"
          )  # it's OK for sequence axis to be different
      match = True
      for batch, list_item in enumerate(list_value):
          ndarray_item = ndarray_value[batch][
              : list_item.shape[0]
          ]  # note gt might be padded
          if not np.isclose(
              ndarray_item, list_item, rtol, atol, equal_nan
          ).all():
              diff = (ndarray_item - list_item) ** 2
              diff_sum = diff.sum(axis=tuple(range(1, len(diff.shape))))
              print(
                  "mismatch found at item {} row {}".format(
                      batch, np.argmax(diff_sum)
                  )
              )
              match = False
              break
      return match
  
imports: import os
  import pickle
  import numpy
  from collections import namedtuple
label_desc: Use image node_id 1 for calling a global function with example usage: _compare_list_to_ndarray(list_value, ndarray_value, rtol, atol, equal_nan) and returns: match