code: def test_sparse_device_placement(dtype):
      # If a GPU is available, tests that all optimizer ops can be placed on
      # it (i.e. they have GPU kernels).
      var = tf.Variable([[1.0], [2.0]])
      indices = tf.constant([0, 1], dtype=dtype)
  
      def g_sum():
          return tf.math.reduce_sum(tf.gather(var, indices))
  
      optimizer = lazy_adam.LazyAdam(3.0)
      optimizer.minimize(g_sum, var_list=[var])
  
file_path: addons/tensorflow_addons/optimizers/tests/lazy_adam_test.py
imports: import numpy
  import tensorflow
  from tensorflow_addons.optimizers import lazy_adam
  from tensorflow_addons.utils import test_utils
  import pytest
label_desc: Use image node_id 5 for calling a global function with example usage: test_sparse_device_placement(dtype) and returns: tf