code: def check_gradients(self, g_0, g_1, g_2, g_3, g_ave):
      msg = "same gradients for different devices"
      self.assertGreater(np.sum(np.abs(g_0 - g_1)), 0.0, msg)
      self.assertGreater(np.sum(np.abs(g_0 - g_2)), 0.0, msg)
      self.assertGreater(np.sum(np.abs(g_0 - g_3)), 0.0, msg)
      self.assertGreater(np.sum(np.abs(g_1 - g_2)), 0.0, msg)
      self.assertGreater(np.sum(np.abs(g_1 - g_3)), 0.0, msg)
      self.assertGreater(np.sum(np.abs(g_2 - g_3)), 0.0, msg)
      g_array = np.concatenate(
          [
              g_0.reshape((1, -1)),
              g_1.reshape((1, -1)),
              g_2.reshape((1, -1)),
              g_3.reshape((1, -1)),
          ],
          axis=0,
      )
      g_ave = g_ave.reshape(-1)
      g_np_ave = np.mean(g_array, axis=0)
      self.assertAllClose(g_np_ave, g_ave)
  
imports: from __future__ import absolute_import, print_function
  import os
  import uuid
  import numpy
  import tensorflow
  from niftynet.engine.application_driver import ApplicationDriver
  from niftynet.engine.application_variables import global_vars_init_or_restore
  from niftynet.engine.handler_model import ModelRestorer
  from niftynet.io.misc_io import set_logger
  from niftynet.utilities.util_common import ParserNamespace
  from niftynet.engine.signal import SESS_FINISHED, SESS_STARTED
  from tests.niftynet_testcase import NiftyNetTestCase
label_desc: Use image node_id 6 for calling the ApplicationDriverTest obj's underlying member method code with example usage: obj.check_gradients(g_0, g_1, g_2, g_3, g_ave) without return types