code: def _embedding_bag(
      indices,
      params,
      weights=None,
      combiner="sum",
      name=None,
  ):
      """EmbeddingBag computation.
  
      See [PyTorch op](https://pytorch.org/docs/stable/generated/torch.nn.EmbeddingBag.html).
  
      Equivalent to tf.gather() followed by tf.reduce_{sum,mean}() across the last dimension, with optional
      weights. Fusing these into a single op has massive benefits for execution speed and particularly
      memory usage, as the intermediate output of the gather never needs to be materialized.
  
      Args:
        indices: An int32 or int64 `Tensor` of the indices to gather from
            `params`. Must be at least 2-dimensional, as the last dimension
            will be summed out. Maximum value must be less than params.shape[0].
        params: A float32 `Tensor` from which to gather params. Must be rank 2.
        weights: A float32 `Tensor` of weights which will be applied to each of
            the gathered embedding vectors before the sum step.
        name: A name for the operation (optional).
  
      Returns:
        A `Tensor` of the format specified by `data_format`.
      """
      if weights is None:
          weights = tf.ones_like(indices, dtype=params.dtype)
      elif combiner != "sum":
          raise RuntimeError(
              "Combiner mode must be 'sum' when weights are supplied to EmbeddingBag!"
          )
  
      return _embedding_bag_so.ops.addons_embedding_bag(
          indices, params, weights, combiner=combiner.upper(), name=name
      )
  
file_path: addons/tensorflow_addons/layers/embedding_bag.py
imports: import tensorflow
  from typeguard import typechecked
  from tensorflow_addons.utils.types import Constraint, Initializer, Regularizer
  from tensorflow_addons.utils.resource_loader import LazySO
label_desc: Use image node_id 1 for calling a global function with example usage: _embedding_bag(indices, params, weights, combiner, name) and returns: _embedding_bag_so