code: def compare_tensors(func, y, t, outputs, deriv=False, tol=0.0):
      be = NervanaObject.be
      temp = be.empty(outputs.shape)
      dtypeu = np.float32
      if deriv is True:
          temp[:] = func.bprop(be.array(dtypeu(y)), be.array(dtypeu(t)))
      else:
          # try:
          temp[:] = func(be.array(dtypeu(y)), be.array(dtypeu(t)))
          # except:
          #     import ipdb; ipdb.set_trace()
      cond = np.sum(np.abs(temp.get() - outputs) <= tol)
      assert cond == np.prod(outputs.shape)
  
imports: import itertools
  import numpy
  from neon import NervanaObject
  from neon.backends import gen_backend
  from neon.transforms import CrossEntropyBinary, CrossEntropyMulti, SumSquared, MeanSquared, Misclassification, PrecisionRecall, SmoothL1Loss, SquareHingeLoss
label_desc: Use image node_id 2 for calling a global function with example usage: compare_tensors(func, y, t, outputs, deriv, tol) without return types