code: def do_test_sparse_repeated_indices(
      dtype, optimizer, **optimizer_kwargs
  ):
      """Test for repeated indices in sparse updates.
  
      This test verifies that an update with repeated indices is the same as
      an update with two times the gradient.
  
      Args:
          optimizer: The tensorflow optimizer class to be tested.
          **optimizer_kwargs: The parameters to pass to the construcor of the
              optimizer. Either a constant or a callable. This also passed to
              the optimizer_params in the update_fn.
      """
      # TODO: Fix #347 issue
      if test_utils.is_gpu_available():
          pytest.skip("Wait #347 to be fixed")
  
      repeated_index_update_var = tf.Variable(
          [[1.0], [2.0]], dtype=dtype
      )
      aggregated_update_var = tf.Variable([[1.0], [2.0]], dtype=dtype)
      grad_repeated_index = tf.IndexedSlices(
          tf.constant([0.1, 0.1], shape=[2, 1], dtype=dtype),
          tf.constant([1, 1]),
          tf.constant([2, 1]),
      )
      grad_aggregated = tf.IndexedSlices(
          tf.constant([0.2], shape=[1, 1], dtype=dtype),
          tf.constant([1]),
          tf.constant([2, 1]),
      )
      opt_repeated = optimizer(**optimizer_kwargs)
      _ = opt_repeated.apply_gradients(
          [(grad_repeated_index, repeated_index_update_var)]
      )
      opt_aggregated = optimizer(**optimizer_kwargs)
      _ = opt_aggregated.apply_gradients(
          [(grad_aggregated, aggregated_update_var)]
      )
      np.testing.assert_allclose(
          aggregated_update_var.numpy(),
          repeated_index_update_var.numpy(),
      )
      for _ in range(3):
          opt_repeated.apply_gradients(
              [(grad_repeated_index, repeated_index_update_var)]
          )
          opt_aggregated.apply_gradients(
              [(grad_aggregated, aggregated_update_var)]
          )
          np.testing.assert_allclose(
              aggregated_update_var.numpy(),
              repeated_index_update_var.numpy(),
          )
  
imports: import importlib
  import numpy
  import pytest
  import tensorflow
  from tensorflow_addons.utils import test_utils
  from tensorflow_addons.optimizers import weight_decay_optimizers
label_desc: Use image node_id 2 for calling a global function with example usage: do_test_sparse_repeated_indices(dtype, optimizer) without return types