code: def run_sample(
      iterations, expected, optimizer, sparse=False, rtol=1e-7, atol=0.0
  ):
      var_0 = tf.Variable([1.0, 2.0], dtype=tf.float32)
      var_1 = tf.Variable([4.0, 3.0], dtype=tf.float32)
  
      if sparse:
          grad_0 = tf.IndexedSlices(
              tf.constant([0.1], dtype=tf.float32),
              tf.constant([0]),
              tf.constant([2]),
          )
          grad_1 = tf.IndexedSlices(
              tf.constant([0.02], dtype=tf.float32),
              tf.constant([1]),
              tf.constant([2]),
          )
      else:
          grad_0 = tf.constant([0.1, 0.2], dtype=tf.float32)
          grad_1 = tf.constant([0.01, 0.02], dtype=tf.float32)
  
      grads_and_vars = list(zip([grad_0, grad_1], [var_0, var_1]))
  
      for _ in range(iterations):
          optimizer.apply_gradients(grads_and_vars)
  
      np.testing.assert_allclose(
          var_0.read_value(), expected[0], rtol, atol
      )
      np.testing.assert_allclose(
          var_1.read_value(), expected[1], rtol, atol
      )
  
file_path: addons/tensorflow_addons/optimizers/tests/proximal_adagrad_test.py
imports: import numpy
  import tensorflow
  from tensorflow_addons.optimizers import ProximalAdagrad
label_desc: Use image node_id 1 for calling a global function with example usage: run_sample(iterations, expected, optimizer, sparse, rtol, atol) without return types