class_docstr: The TPUEmbedding Base class.
  
  This class only contains the basic logic to check the feature config and table
  config for the tpu embedding mid level APIs.
docstr: Creates the TPUEmbeddingBase object.
docstr_tok: ["Creates","the","TPUEmbeddingBase","object","."]
code: def __init__(
      self,
      feature_config: Union[
          tpu_embedding_v2_utils.FeatureConfig, Iterable
      ],  # pylint:disable=g-bare-generic
      optimizer: Optional[tpu_embedding_v2_utils._Optimizer] = None,
  ):  # pylint:disable=protected-access
      """Creates the TPUEmbeddingBase object."""
      self._feature_config = feature_config
      self._output_shapes = []
      for feature in nest.flatten(feature_config):
          self._output_shapes.append(feature.output_shape)
      # Set table order here to the order of the first occurrence of the table in
      # a feature provided by the user. The order of this struct must be fixed
      # to provide the user with deterministic behavior over multiple
      # instantiations.
      self._table_config = []
      for feature in nest.flatten(feature_config):
          if feature.table not in self._table_config:
              self._table_config.append(feature.table)
  
      # Ensure tables have unique names. Also error check the optimizer as we
      # specifically don't do that in the TableConfig class to allow high level
      # APIs that are built on this to use strings/other classes to represent
      # optimizers (before they are passed to this class).
      table_names = []
      for i, table in enumerate(self._table_config):
          if table.optimizer is None:
              # TODO(bfontain) Should we allow some sort of optimizer merging here?
              table.optimizer = optimizer
          if table.optimizer is not None and not isinstance(
              table.optimizer, tpu_embedding_v2_utils._Optimizer
          ):  # pylint: disable=protected-access
              raise ValueError(
                  "{} is an unsupported optimizer class. Please pass an "
                  "instance of one of the optimizer classes under "
                  "tf.tpu.experimental.embedding.".format(
                      type(table.optimizer)
                  )
              )
          if table.name is None:
              table.name = "table_{}".format(i)
          if table.name in table_names:
              raise ValueError(
                  "Tables must have a unique name. "
                  f"Multiple tables with name {table.name} found."
              )
          table_names.append(table.name)
  
      self._built = False
  
file_path: tensorflow-upstream/tensorflow/python/tpu/tpu_embedding_base.py
imports: import functools
  from typing import Any, Dict, Iterable, Optional, Union, Text
  from tensorflow.python.framework import dtypes
  from tensorflow.python.ops import variables
  from tensorflow.python.tpu import tpu_embedding_v2_utils
  from tensorflow.python.trackable import autotrackable
  from tensorflow.python.util import nest
label_desc: Use image node_id 1 to create a new TPUEmbeddingBase object from inherited base classes: autotrackable with example: obj = TPUEmbeddingBase(feature_config, optimizer)