code: def compare_output_and_grad_input(
      self, model1, model2, input_data, rtol=1e-6, atol=1e-6
  ):
      # Set seed in case of random factors such as dropout.
      rng = RNG()
      rng.set_seed(1000)
      output1 = model1.forward(input_data)
      rng.set_seed(1000)
      output2 = model2.forward(input_data)
      if isinstance(output1, list):
          self.assert_list_allclose(output1, output2, rtol, atol)
      else:
          self.assert_allclose(output1, output2, rtol, atol)
      rng.set_seed(1000)
      grad_input1 = model1.backward(input_data, output1)
      rng.set_seed(1000)
      grad_input2 = model2.backward(input_data, output1)
      if isinstance(grad_input1, list):
          self.assert_list_allclose(
              grad_input1, grad_input2, rtol, atol
          )
      else:
          self.assert_allclose(grad_input1, grad_input2, rtol, atol)
  
imports: from __future__ import print_function
  import logging
  import shutil
  from unittest import TestCase
  import keras.backend
  from bigdl.dllib.nncontext import *
  from bigdl.dllib.feature.image import ImageSet
label_desc: Use image node_id 12 for calling the ZooTestCase obj's underlying member method code with example usage: obj.compare_output_and_grad_input(model1, model2, input_data, rtol, atol) without return types