code: def testSparse(self):
      if self.primary_device == "TPU":
          self.skipTest("IndexedSlices not supported on TPU.")
  
      parameters = [
          tf.Variable([[1.0], [2.0]]),
          tf.Variable([[3.0], [4.0]]),
      ]
      updates = [
          tf.IndexedSlices(
              tf.constant([0.1], shape=[1, 1]),
              tf.constant([0]),
              tf.constant([2, 1]),
          ),
          tf.IndexedSlices(
              tf.constant([0.01], shape=[1, 1]),
              tf.constant([1]),
              tf.constant([2, 1]),
          ),
      ]
      optimizer = self.make_optimizer(learning_rate=3.0)
      optimizer.apply(updates, parameters)
      self.assertAllClose(
          [[1.0 - 3.0 * 0.1], [2.0]], parameters[0].numpy()
      )
      self.assertAllClose(
          [[3.0], [4.0 - 3.0 * 0.01]], parameters[1].numpy()
      )
  
file_path: sonnet/sonnet/src/optimizers/sgd_test.py
imports: from sonnet.src.optimizers import optimizer_tests
  from sonnet.src.optimizers import sgd
  import tensorflow
label_desc: Use image node_id 3 for calling the SGDTest obj's underlying member method code with example usage: obj.testSparse() without return types