docstr: Compute gradients wrt embedding_table.
  
  Args:
    gradient_wrt_activation: `np.array` with shape `batch_size` by embedding
      `dimension`.
    embedding_table: `np.array` with shape `vocabulary_size` by embedding
      `dimension`.
    feature_indices: `indices` as used to construct `SparseTensor`.
    feature_values: `values` as used to construct `SparseTensor`.
    combiner: `String`, 'mean' or 'sum'.
  
  Returns:
    Gradients wrt `embedding_table`, an `np.array`s with shape
      `batch_size` by `vocabulary_size` by
      embedding `dimension`.
  
  Raises:
    ValueError: if `combiner` is not one of 'mean' or 'sum'.
docstr_tok: ["Compute","gradients","wrt","embedding_table",".","Args",":","gradient_wrt_activation",":","`","np.array","`","with","shape","`","batch_size","`","by","embedding","`","dimension","`",".","embedding_table",":","`","np.array","`","with","shape","`","vocabulary_size","`","by","embedding","`","dimension","`",".","feature_indices",":","`","indices","`","as","used","to","construct","`","SparseTensor","`",".","feature_values",":","`","values","`","as","used","to","construct","`","SparseTensor","`",".","combiner",":","`","String","`",",","'mean","'","or","'sum","'",".","Returns",":","Gradients","wrt","`","embedding_table","`",",","an","`","np.array","`","s","with","shape","`","batch_size","`","by","`","vocabulary_size","`","by","embedding","`","dimension","`",".","Raises",":","ValueError",":","if","`","combiner","`","is","not","one","of","'mean","'","or","'sum","'","."]
code: def _compute_gradients_wrt_embedding_table(
      self,
      gradient_wrt_activation,
      embedding_table,
      feature_indices,
      feature_values,
      combiner,
  ):
      """Compute gradients wrt embedding_table.
  
      Args:
        gradient_wrt_activation: `np.array` with shape `batch_size` by embedding
          `dimension`.
        embedding_table: `np.array` with shape `vocabulary_size` by embedding
          `dimension`.
        feature_indices: `indices` as used to construct `SparseTensor`.
        feature_values: `values` as used to construct `SparseTensor`.
        combiner: `String`, 'mean' or 'sum'.
  
      Returns:
        Gradients wrt `embedding_table`, an `np.array`s with shape
          `batch_size` by `vocabulary_size` by
          embedding `dimension`.
  
      Raises:
        ValueError: if `combiner` is not one of 'mean' or 'sum'.
      """
      if combiner not in ("mean", "sum"):
          raise ValueError(
              "`combiner` must be mean or sum; got {}.".format(combiner)
          )
      grads_shape = (
          gradient_wrt_activation.shape[:-1] + embedding_table.shape
      )
      grads = np.zeros(shape=grads_shape)
      count = np.zeros(shape=grads_shape)
      for feature_indice, vocabulary_id in zip(
          feature_indices, feature_values
      ):
          batch_index = tuple(feature_indice[:-1])
          grads[batch_index][vocabulary_id] += gradient_wrt_activation[
              batch_index
          ]
          count[batch_index] += 1
      count[count == 0] = 1
      if combiner == "mean":
          grads = grads / count
      return np.reshape(grads, (-1, *embedding_table.shape))
  
imports: import os
  from typing import Tuple
  from absl import flags
  from absl.testing import parameterized
  import numpy
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.distribute import tpu_strategy
  from tensorflow.python.distribute.cluster_resolver import tpu_cluster_resolver
  from tensorflow.python.eager import remote
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import sparse_tensor
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gen_math_ops
  from tensorflow.python.ops import init_ops_v2
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops.ragged import ragged_tensor
  from tensorflow.python.platform import test
  from tensorflow.python.tpu import tpu_embedding_v2
  from tensorflow.python.tpu import tpu_embedding_v2_utils
  from tensorflow.python.util import nest
label_desc: Use image node_id 22 for calling the TPUEmbeddingBaseTest obj's underlying member method code with example usage: obj._compute_gradients_wrt_embedding_table(gradient_wrt_activation, embedding_table, feature_indices, feature_values, combiner) and returns: np