code: def testSparseNesterov(self):
      if self.primary_device in ("GPU", "TPU"):
          self.skipTest(
              "IndexedSlices not supported on {}.".format(
                  self.primary_device
              )
          )
  
      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, momentum=0.9, use_nesterov=True
      )
      # Step 1 of Momentum
      optimizer.apply(updates, parameters)
      self.assertAllClose([[0.43], [2.0]], parameters[0].numpy())
      self.assertAllClose([[3.0], [3.943]], parameters[1].numpy())
      # Step 2 of Momentum
      optimizer.apply(updates, parameters)
      self.assertAllClose([[-0.383], [2.0]], parameters[0].numpy())
      self.assertAllClose([[3.0], [3.8617]], parameters[1].numpy())
      # Step 3 of Momentum
      optimizer.apply(updates, parameters)
      self.assertAllClose([[-1.4147], [2.0]], parameters[0].numpy())
      self.assertAllClose([[3.0], [3.75853]], parameters[1].numpy())
  
imports: from sonnet.src import test_utils
  from sonnet.src.optimizers import momentum
  from sonnet.src.optimizers import optimizer_tests
  import tensorflow
label_desc: Use image node_id 5 for calling the MomentumTest obj's underlying member method code with example usage: obj.testSparseNesterov() without return types