code: def test_gather_indices():
      batch_dim = 3
      data_in = keras.Input(batch_shape=(batch_dim, 5, 7))
      indices_in = keras.Input(
          batch_shape=(batch_dim, 11), dtype="int32"
      )
  
      data = np.arange(np.product(data_in.shape)).reshape(data_in.shape)
      indices = np.random.choice(
          range(min(data_in.shape)), indices_in.shape
      )
  
      # check that the layer acts the same as tf.gather
      def run(**kwargs):
          layer = GatherIndices(**kwargs)
          expected = tf.gather(data, indices, **kwargs)
  
          out = GatherIndices(**kwargs)([data_in, indices_in])
          model = keras.Model(inputs=[data_in, indices_in], outputs=out)
          pred = model.predict([data, indices])
          np.testing.assert_array_equal(pred, expected)
  
      # default settings
      run()
      # with a batch dimension
      run(batch_dims=1)
      # various other forms...
      run(axis=1)
      run(batch_dims=1, axis=2)
  
file_path: stellargraph/tests/layer/test_misc.py
imports: import tensorflow
  from tensorflow import keras
  import numpy
  import scipy.sparse
  import pytest
  from stellargraph.layer.misc import *
  from ..test_utils.graphs import create_graph_features, example_graph
  from stellargraph.mapper import *
  from stellargraph.layer import *
label_desc: Use image node_id 5 for calling a global function with example usage: test_gather_indices() without return types