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: Create all variables including table variables and slot variables.
docstr_tok: ["Create","all","variables","including","table","variables","and","slot","variables","."]
code: def _create_variables(
      self, table: tpu_embedding_v2_utils.TableConfig, trainable: bool
  ) -> Dict[Text, tf_variables.Variable]:
      """Create all variables including table variables and slot variables."""
      variable_shape = (table.vocabulary_size, table.dim)
  
      def getter(name, shape, dtype, initializer, trainable):
          del shape
          # _add_variable_with_custom_getter clears the shape sometimes, so we
          # take the global shape from outside the getter.
          initial_value = functools.partial(
              initializer, variable_shape, dtype=dtype
          )
          return tf_variables.Variable(
              name=name,
              initial_value=initial_value,
              shape=variable_shape,
              dtype=dtype,
              trainable=trainable,
          )
  
      def variable_creator(name, initializer, trainable=True):
          # Use add_variable_with_custom_getter here so that we take advantage of
          # the checkpoint loading to allow restore before the variables get
          # created which avoids double initialization.
          return self._add_variable_with_custom_getter(
              name=name,
              initializer=initializer,
              shape=variable_shape,
              dtype=dtypes.float32,
              getter=getter,
              trainable=trainable,
          )
  
      parameters = variable_creator(
          table.name, table.initializer, trainable=trainable
      )
  
      def slot_creator(name, initializer):
          return variable_creator(
              table.name + "/" + name, initializer, False
          )
  
      if table.optimizer is not None:
          slot_vars = table.optimizer._create_slots(
              parameters, slot_creator
          )  # pylint: disable=protected-access
      else:
          slot_vars = {}
      slot_vars["parameters"] = parameters
      return slot_vars
  
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 3 for calling the TPUEmbeddingBase obj's underlying member method code with example usage: obj._create_variables(table, trainable) and returns: slot_vars, tf_variables, self, variable_creator