class_docstr: EmbeddingBag Layer.
  
  See [PyTorch op](https://pytorch.org/docs/stable/generated/torch.nn.EmbeddingBag.html).
  
  Equivalent to tf.gather() followed by tf.reduce_sum() 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.
  
  Input Shapes:
    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.
  
  Output shape:
      indices.shape[:-1], params.shape[-1]
code: def __init__(
      self,
      input_dim: int,
      output_dim: int,
      embeddings_initializer: Initializer = "uniform",
      embeddings_regularizer: Regularizer = None,
      embeddings_constraint: Constraint = None,
      mask_zero: bool = False,
      combiner: str = "sum",
      **kwargs,
  ):
      super(EmbeddingBag, self).__init__(**kwargs)
      if input_dim <= 0 or output_dim <= 0:
          raise ValueError(
              "Both `input_dim` and `output_dim` should be positive, "
              "found input_dim {} and output_dim {}".format(
                  input_dim, output_dim
              )
          )
      self.input_dim = input_dim
      self.output_dim = output_dim
      self.embeddings_initializer = tf.keras.initializers.get(
          embeddings_initializer
      )
      self.embeddings_regularizer = tf.keras.regularizers.get(
          embeddings_regularizer
      )
      self.embeddings_constraint = tf.keras.constraints.get(
          embeddings_constraint
      )
      self.mask_zero = mask_zero
      self.supports_masking = mask_zero
      self.combiner = combiner
  
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 to create a new EmbeddingBag object from inherited base classes: tf.keras.layers with example: obj = EmbeddingBag(input_dim, output_dim, embeddings_initializer, embeddings_regularizer, embeddings_constraint, mask_zero, combiner)