code: def _test_disjoint_mode(layer, sparse=False, **kwargs):
      A = sp.block_diag(
          [np.ones((N1, N1)), np.ones((N2, N2)), np.ones((N3, N3))]
      ).todense()
      X = np.random.normal(size=(N, F))
      I = np.array([0] * N1 + [1] * N2 + [2] * N3).astype(int)
  
      A_in = Input(shape=(None,), sparse=sparse)
      X_in = Input(shape=(F,))
      I_in = Input(shape=(), dtype=tf.int32)
      inputs = [X_in, A_in, I_in]
  
      if sparse:
          input_data = [X, sp_matrix_to_sp_tensor(A), I]
      else:
          input_data = [X, A, I]
  
      layer_instance = layer(**kwargs)
      output = layer_instance(inputs)
      model = Model(inputs, output)
  
      output = model(input_data)
  
      X_pool, A_pool, I_pool, s = output
  
      if "ratio" in kwargs.keys():
          N_pool_expected = int(
              np.ceil(kwargs["ratio"] * N1)
              + np.ceil(kwargs["ratio"] * N2)
              + np.ceil(kwargs["ratio"] * N3)
          )
      elif "k" in kwargs.keys():
          N_pool_expected = int(kwargs["k"])
      else:
          N_pool_expected = None
      N_pool_true = A_pool.shape[0]
  
      if N_pool_expected is not None:
          _check_number_of_nodes(N_pool_expected, N_pool_true)
  
          assert X_pool.shape == (N_pool_expected, F)
          assert A_pool.shape == (N_pool_expected, N_pool_expected)
          assert I_pool.shape == (N_pool_expected,)
  
      output_shape = [o.shape for o in output]
      _check_output_and_model_output_shapes(
          output_shape, model.output_shape
      )
  
file_path: spektral/tests/test_layers/pooling/core.py
imports: import numpy
  import scipy.sparse
  import tensorflow
  from tensorflow.keras import Input, Model
  from spektral.utils.sparse import sp_matrix_to_sp_tensor
  from tests.test_layers.convolutional.core import _test_get_config
label_desc: Use image node_id 5 for calling a global function with example usage: _test_disjoint_mode(layer, sparse) without return types