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: Constructor of SparseFeatureEmbedding.
  
  Args:
    de_config: A de_config_pb2.DynamicEmbeddingConfig that configures the
      embedding.
    feature_map: A map from feature name to (embedding_dim, sigma_dim) pair
    op_name: A string, along with de_config, to uniquely identifying the
      embedding data in knowledge bank.
    em_steps: An integer, if not zero, specifies the steps for training the
      embedding and sigma function alternatively. It is show in the CAML paper
      that sometimes a better performance can be achieved if we do not train
      both embedding and sigma function simultaneously.
    service_address: A string denoting the address to a KnowledgeBankService.
    timeout_ms: A integer, if positive, denoting the timeout deadline in
      milliseconds when connecting to the KnowledgeBankService.
docstr_tok: ["Constructor","of","SparseFeatureEmbedding",".","Args",":","de_config",":","A","de_config_pb2.DynamicEmbeddingConfig","that","configures","the","embedding",".","feature_map",":","A","map","from","feature","name","to","(","embedding_dim",",","sigma_dim",")","pair","op_name",":","A","string",",","along","with","de_config",",","to","uniquely","identifying","the","embedding","data","in","knowledge","bank",".","em_steps",":","An","integer",",","if","not","zero",",","specifies","the","steps","for","training","the","embedding","and","sigma","function","alternatively",".","It","is","show","in","the","CAML","paper","that","sometimes","a","better","performance","can","be","achieved","if","we","do","not","train","both","embedding","and","sigma","function","simultaneously",".","service_address",":","A","string","denoting","the","address","to","a","KnowledgeBankService",".","timeout_ms",":","A","integer",",","if","positive",",","denoting","the","timeout","deadline","in","milliseconds","when","connecting","to","the","KnowledgeBankService","."]
code: def __init__(
      self,
      de_config: de_config_pb2.DynamicEmbeddingConfig,
      feature_map: typing.Dict[typing.Text, typing.Tuple[int, int]],
      op_name: typing.Text,
      em_steps: int = 0,
      service_address: typing.Text = "",
      timeout_ms: int = -1,
  ):
      """Constructor of SparseFeatureEmbedding.
  
      Args:
        de_config: A de_config_pb2.DynamicEmbeddingConfig that configures the
          embedding.
        feature_map: A map from feature name to (embedding_dim, sigma_dim) pair
        op_name: A string, along with de_config, to uniquely identifying the
          embedding data in knowledge bank.
        em_steps: An integer, if not zero, specifies the steps for training the
          embedding and sigma function alternatively. It is show in the CAML paper
          that sometimes a better performance can be achieved if we do not train
          both embedding and sigma function simultaneously.
        service_address: A string denoting the address to a KnowledgeBankService.
        timeout_ms: A integer, if positive, denoting the timeout deadline in
          milliseconds when connecting to the KnowledgeBankService.
      """
      super(SparseFeatureEmbedding, self).__init__()
      if not op_name:
          raise ValueError(
              "Must use a non-empty op_name for each SparseFeatureEmbedding."
          )
      self._feature_map = feature_map
      self._variable_map = {}
      self._de_config = de_config
      self._op_name = op_name
      self._em_steps = em_steps
      self._service_address = service_address
      self._timeout_ms = timeout_ms
  
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 1 to create a new SparseFeatureEmbedding object from inherited base classes: tf.keras.layers with example: obj = SparseFeatureEmbedding(de_config, feature_map, op_name, em_steps, service_address, timeout_ms)