code: def test_optimizer_sparse(
      self,
      optimizer_fn: ModuleFn,
      input_shape: Tuple[int],
      dtype: tf.DType,
      autograph: bool,
  ):
      del input_shape, dtype  # Unused.
      if self.primary_device == "TPU":
          self.skipTest("IndexedSlices not supported on TPU.")
      parameters = [tf.Variable([[1.0], [2.0]])]
      updates = [
          tf.IndexedSlices(
              tf.constant([0.1], shape=[1, 1]),
              tf.constant([0]),
              tf.constant([2, 1]),
          )
      ]
      optimizer = optimizer_fn()
      optimizer_apply = tf.function(
          optimizer.apply, autograph=autograph
      )
      optimizer_apply(updates, parameters)
  
file_path: sonnet/sonnet/src/conformance/function_test.py
imports: from typing import Callable, Tuple
  from absl.testing import parameterized
  import sonnet
  from sonnet.src import test_utils
  from sonnet.src.conformance import descriptors
  import tensorflow
label_desc: Use image node_id 6 for calling the FunctionTest obj's underlying member method code with example usage: obj.test_optimizer_sparse(optimizer_fn, input_shape, dtype, autograph) without return types