code: def testMinimizeWith2DIndicesForEmbeddingLookup(self):
      # This test invokes the ResourceSparseApplyMomentum operation, which
      # did not have a registered GPU kernel as of April 2018. With graph
      # execution, the placement algorithm notices this and automatically
      # places the variable in CPU (host) memory. With eager execution,
      # the variable would be placed in GPU memory if available, which
      # would then conflict with the future invocation of the
      # ResourceSparseApplyMomentum operation.
      # To work around this discrepancy, for now we force the variable
      # to be placed on CPU.
      with ops.device("/cpu:0"):
          var0 = resource_variable_ops.ResourceVariable(
              array_ops.ones([2, 2])
          )
  
      def loss():
          return math_ops.reduce_sum(
              embedding_ops.embedding_lookup(var0, [[1]])
          )
  
      opt = momentum_lib.MomentumOptimizer(
          learning_rate=1.0, momentum=0.0
      )
      sgd_op = opt.minimize(loss)
      self.evaluate(variables.global_variables_initializer())
      self.evaluate(sgd_op)
      self.assertAllCloseAccordingToType(
          [[1, 1], [0, 0]], self.evaluate(var0)
      )
  
imports: import numpy
  from tensorflow.python.eager import context
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import indexed_slices
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import embedding_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import resource_variable_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import test
  from tensorflow.python.training import momentum
label_desc: Use image node_id 10 for calling the MomentumOptimizerTest obj's underlying member method code with example usage: obj.testMinimizeWith2DIndicesForEmbeddingLookup() and returns: math_ops