parameters: (params,
                                     sparse_values,
                                     dimension,
                                     combiner="mean",
                                     default_value=None,
                                     name=None)
docstring: Looks up embeddings of a sparse feature using parameter hashing.
  
    See `tf.contrib.layers.hashed_embedding_lookup` for embedding with hashing.
  
    Args:
      params: A `Tensor` or `list` of `Tensors`.
        Each tensor must be of rank 1 with fully-defined shape.
      sparse_values: A 2-D `SparseTensor` containing the values to be embedded.
        Some rows may be empty.
      dimension: Embedding dimension
      combiner: A string specifying how to combine embedding results for each
          entry. Currently "mean", "sqrtn" and "sum" are supported, with "mean"
          the default.
      default_value: The value to use for an entry with no features.
      name: An optional name for this op.
  
    Returns:
       Dense tensor with shape [N, dimension] with N the number of rows in
         sparse_values.
  
    Raises:
      TypeError: If sparse_values is not a SparseTensor.
      ValueError: If combiner is not one of {"mean", "sqrtn", "sum"}.
docstring_summary: Looks up embeddings of a sparse feature using parameter hashing.
docstring_tokens: Looks up embeddings of a sparse feature using parameter hashing .
function: def hashed_embedding_lookup_sparse(params,
                                     sparse_values,
                                     dimension,
                                     combiner="mean",
                                     default_value=None,
                                     name=None):
    """Looks up embeddings of a sparse feature using parameter hashing.
  
    See `tf.contrib.layers.hashed_embedding_lookup` for embedding with hashing.
  
    Args:
      params: A `Tensor` or `list` of `Tensors`.
        Each tensor must be of rank 1 with fully-defined shape.
      sparse_values: A 2-D `SparseTensor` containing the values to be embedded.
        Some rows may be empty.
      dimension: Embedding dimension
      combiner: A string specifying how to combine embedding results for each
          entry. Currently "mean", "sqrtn" and "sum" are supported, with "mean"
          the default.
      default_value: The value to use for an entry with no features.
      name: An optional name for this op.
  
    Returns:
       Dense tensor with shape [N, dimension] with N the number of rows in
         sparse_values.
  
    Raises:
      TypeError: If sparse_values is not a SparseTensor.
      ValueError: If combiner is not one of {"mean", "sqrtn", "sum"}.
    """
  
    if not isinstance(params, list):
      params = [params]
    if not isinstance(sparse_values, ops.SparseTensor):
      raise TypeError("sparse_values must be SparseTensor")
  
    with ops.op_scope(params + [sparse_values], name,
                      "hashed_sparse_embedding_lookup") as scope:
      # Fill in the empty rows.
      if default_value is None:
        # Random default values to reduce the risk of collision.
        if sparse_values.dtype == dtypes.string:
          default_value = "6ZxWzWOHxZ"
        else:
          default_value = 1288896567
      sparse_values, _ = sparse_ops.sparse_fill_empty_rows(
          sparse_values, default_value)
  
      segment_ids = sparse_values.indices[:, 0]
      if segment_ids.dtype != dtypes.int32:
        segment_ids = math_ops.cast(segment_ids, dtypes.int32)
  
      values = sparse_values.values
      values, idx = array_ops.unique(values)
  
      embeddings = hashed_embedding_lookup(params, values, dimension)
  
      if combiner == "sum":
        embeddings = math_ops.sparse_segment_sum(embeddings, idx, segment_ids,
                                                 name=scope)
      elif combiner == "mean":
        embeddings = math_ops.sparse_segment_mean(embeddings, idx, segment_ids,
                                                  name=scope)
      elif combiner == "sqrtn":
        embeddings = math_ops.sparse_segment_sqrt_n(embeddings, idx, segment_ids,
                                                    name=scope)
      else:
        raise ValueError("Combiner must be one of 'mean', 'sqrtn' or 'sum'.")
  
      return embeddings
function_tokens: def hashed_embedding_lookup_sparse ( params , sparse_values , dimension , combiner = "mean" , default_value = None , name = None ) : if not isinstance ( params , list ) : params = [ params ] if not isinstance ( sparse_values , ops . SparseTensor ) : raise TypeError ( "sparse_values must be SparseTensor" ) with ops . op_scope ( params + [ sparse_values ] , name , "hashed_sparse_embedding_lookup" ) as scope : # Fill in the empty rows. if default_value is None : # Random default values to reduce the risk of collision. if sparse_values . dtype == dtypes . string : default_value = "6ZxWzWOHxZ" else : default_value = 1288896567 sparse_values , _ = sparse_ops . sparse_fill_empty_rows ( sparse_values , default_value ) segment_ids = sparse_values . indices [ : , 0 ] if segment_ids . dtype != dtypes . int32 : segment_ids = math_ops . cast ( segment_ids , dtypes . int32 ) values = sparse_values . values values , idx = array_ops . unique ( values ) embeddings = hashed_embedding_lookup ( params , values , dimension ) if combiner == "sum" : embeddings = math_ops . sparse_segment_sum ( embeddings , idx , segment_ids , name = scope ) elif combiner == "mean" : embeddings = math_ops . sparse_segment_mean ( embeddings , idx , segment_ids , name = scope ) elif combiner == "sqrtn" : embeddings = math_ops . sparse_segment_sqrt_n ( embeddings , idx , segment_ids , name = scope ) else : raise ValueError ( "Combiner must be one of 'mean', 'sqrtn' or 'sum'." ) return embeddings