class_docstr: A Keras Layer for sparse feature embedding based on CAML.
  
  Example usage:
    feat_embed = SparseFeatureEmbedding(
        de_config, {"first_fea": (10, 1), "second_fea": (5, 1)})
  
    # emb is a [batch_size, 15] Tensor.
    emb = feat_embed({"first_fea": first_tensor, "second_fea": second_tensor})
class_docstr_tok: ["A","Keras","Layer","for","sparse","feature","embedding","based","on","CAML",".","Example","usage",":","feat_embed","=","SparseFeatureEmbedding","(","de_config",",","{","``","first_fea","''",":","(","10",",","1",")",",","``","second_fea","''",":","(","5",",","1",")","}",")","#","emb","is","a","[","batch_size",",","15","]","Tensor",".","emb","=","feat_embed","(","{","``","first_fea","''",":","first_tensor",",","``","second_fea","''",":","second_tensor","}",")"]
docstr: Returns the embeddings of given feature keys.
  
  Args:
    feature_keys: A string `Tensor` of shape [batch_size, None] or a map from
      feature name to a string `Tensor` of shape [batch_size, None].
  
  Returns:
    A tuple of
    - A float `Tensor` of shape [batch_size, concat_embedding_dim] where
      concat_embedding_dim is the concated embedding of all feature columns.
    - A float `Tensor` of shape [batch_size, concat_vc_embedding_dim].
    - A float `Tensor` of shape [batch_size, concat_sigma_embedding_dim].
    - A map from feature name to a float `Tensor` of shape
      [batch_size, embedding_dim] (2D) or
      [batch_size, max_sequence_length, embedding_dim] (3D) representing the
      input embedding before applying embedding decomposition formula.
  Raises:
    RuntimeError: if feature_map is empty.
docstr_tok: ["Returns","the","embeddings","of","given","feature","keys",".","Args",":","feature_keys",":","A","string","`","Tensor","`","of","shape","[","batch_size",",","None","]","or","a","map","from","feature","name","to","a","string","`","Tensor","`","of","shape","[","batch_size",",","None","]",".","Returns",":","A","tuple","of","-","A","float","`","Tensor","`","of","shape","[","batch_size",",","concat_embedding_dim","]","where","concat_embedding_dim","is","the","concated","embedding","of","all","feature","columns",".","-","A","float","`","Tensor","`","of","shape","[","batch_size",",","concat_vc_embedding_dim","]",".","-","A","float","`","Tensor","`","of","shape","[","batch_size",",","concat_sigma_embedding_dim","]",".","-","A","map","from","feature","name","to","a","float","`","Tensor","`","of","shape","[","batch_size",",","embedding_dim","]","(","2D",")","or","[","batch_size",",","max_sequence_length",",","embedding_dim","]","(","3D",")","representing","the","input","embedding","before","applying","embedding","decomposition","formula",".","Raises",":","RuntimeError",":","if","feature_map","is","empty","."]
code: def lookup(self, feature_keys):
      """Returns the embeddings of given feature keys.
  
      Args:
        feature_keys: A string `Tensor` of shape [batch_size, None] or a map from
          feature name to a string `Tensor` of shape [batch_size, None].
  
      Returns:
        A tuple of
        - A float `Tensor` of shape [batch_size, concat_embedding_dim] where
          concat_embedding_dim is the concated embedding of all feature columns.
        - A float `Tensor` of shape [batch_size, concat_vc_embedding_dim].
        - A float `Tensor` of shape [batch_size, concat_sigma_embedding_dim].
        - A map from feature name to a float `Tensor` of shape
          [batch_size, embedding_dim] (2D) or
          [batch_size, max_sequence_length, embedding_dim] (3D) representing the
          input embedding before applying embedding decomposition formula.
      Raises:
        RuntimeError: if feature_map is empty.
      """
      if not self._feature_map:
          raise RuntimeError("Feature map is empty.")
      if not isinstance(feature_keys, dict):
          if len(self._feature_map) != 1:
              raise TypeError(
                  "Input a single key tensor but the feature size is not one: %d."
                  % len(self._feature_map)
              )
          feature_keys = {
              list(self._feature_map.keys())[0]: feature_keys
          }
      embedding_list = []
      vc_list = []
      sigma_list = []
      input_embedding_map = {}
      for name, keys in feature_keys.items():
          if name not in self._feature_map:
              raise RuntimeError(
                  "input feature %s is not in feature map." % name
              )
          embed_dim, sigma_dim = self._feature_map[name]
          input_variables = None
          if name in self._variable_map.keys():
              input_variables = self._variable_map[name]
          (
              embed,
              vc,
              sigma,
              input_embed,
              variables,
          ) = embed_single_feature(
              keys,
              self._de_config,
              embed_dim,
              sigma_dim,
              "%s_%s" % (self._op_name, name),
              self._em_steps,
              input_variables,
              service_address=self._service_address,
              timeout_ms=self._timeout_ms,
          )
          if not input_variables:
              self._variable_map[name] = variables
          embedding_list.append(embed)
          input_embedding_map[name] = input_embed
          if vc is not None:
              vc_list.append(vc)
          if sigma is not None:
              sigma_list.append(sigma)
  
      vc_concat = tf.concat(vc_list, -1) if vc_list else None
      sigma_concat = tf.concat(sigma_list, -1) if sigma_list else None
      embedding_concat = tf.concat(embedding_list, -1)
      return (
          embedding_concat,
          vc_concat,
          sigma_concat,
          input_embedding_map,
      )
  
imports: import collections
  import threading
  import typing
  from research.carls import dynamic_embedding_config_pb2
  from research.carls import dynamic_embedding_ops
  from six.moves import range
  import tensorflow
label_desc: Use image node_id 5 for calling the SparseFeatureEmbedding obj's underlying member method code with example usage: obj.lookup(feature_keys) and returns: embedding_concat,  vc_concat,  sigma_concat,  input_embedding_map