code: def get_gradients_through_compute_gradients(
      optimizer, loss, activations
  ):
      """Compute gradients to send to TPU embedding.
  
      Args:
        optimizer: a subclass of optimizer.Optimizer, usually CrossShardOptimizer.
          Used to call compute_gradients().
        loss: a Tensor to call optimizer.compute_gradients() on.
        activations: an OrderedDict mapping feature_name to Tensors of activations.
  
      Returns:
        An OrderedDict mapping from feature name Strings to Tensors of gradients of
          the loss wrt the activations of the features.
      """
      activation_list = activations.values()
      grads_and_vars = optimizer.compute_gradients(
          loss, activation_list
      )
      grads = [grad for grad, _ in grads_and_vars]
      feature_to_gradient_dict = collections.OrderedDict(
          zip(activations.keys(), grads)
      )
      return feature_to_gradient_dict
  
file_path: tensorflow-upstream/tensorflow/python/tpu/tpu_embedding_gradient.py
imports: import collections
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import variable_scope
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.tpu.ops import tpu_ops
label_desc: Use image node_id 1 for calling a global function with example usage: get_gradients_through_compute_gradients(optimizer, loss, activations) and returns: feature_to_gradient_dict