parameters: (sp_input, vocab_size, name=None)
docstring: Converts a `SparseTensor` of ids into a dense bool indicator tensor.
  
    The last dimension of `sp_input.indices` is discarded and replaced with
    the values of `sp_input`.  If `sp_input.dense_shape = [D0, D1, ..., Dn, K]`,
    then `output.shape = [D0, D1, ..., Dn, vocab_size]`, where
  
        output[d_0, d_1, ..., d_n, sp_input[d_0, d_1, ..., d_n, k]] = True
  
    and False elsewhere in `output`.
  
    For example, if `sp_input.dense_shape = [2, 3, 4]` with non-empty values:
  
        [0, 0, 0]: 0
        [0, 1, 0]: 10
        [1, 0, 3]: 103
        [1, 1, 2]: 150
        [1, 1, 3]: 149
        [1, 1, 4]: 150
        [1, 2, 1]: 121
  
    and `vocab_size = 200`, then the output will be a `[2, 3, 200]` dense bool
    tensor with False everywhere except at positions
  
        (0, 0, 0), (0, 1, 10), (1, 0, 103), (1, 1, 149), (1, 1, 150),
        (1, 2, 121).
  
    Note that repeats are allowed in the input SparseTensor.
    This op is useful for converting `SparseTensor`s into dense formats for
    compatibility with ops that expect dense tensors.
  
    The input `SparseTensor` must be in row-major order.
  
    Args:
      sp_input: A `SparseTensor` with `values` property of type `int32` or
        `int64`.
      vocab_size: A scalar int64 Tensor (or Python int) containing the new size
        of the last dimension, `all(0 <= sp_input.values < vocab_size)`.
      name: A name prefix for the returned tensors (optional)
  
    Returns:
      A dense bool indicator tensor representing the indices with specified value.
  
    Raises:
      TypeError: If `sp_input` is not a `SparseTensor`.
docstring_summary: Converts a `SparseTensor` of ids into a dense bool indicator tensor.
docstring_tokens: Converts a SparseTensor of ids into a dense bool indicator tensor .
function: def sparse_to_indicator(sp_input, vocab_size, name=None):
    """Converts a `SparseTensor` of ids into a dense bool indicator tensor.
  
    The last dimension of `sp_input.indices` is discarded and replaced with
    the values of `sp_input`.  If `sp_input.dense_shape = [D0, D1, ..., Dn, K]`,
    then `output.shape = [D0, D1, ..., Dn, vocab_size]`, where
  
        output[d_0, d_1, ..., d_n, sp_input[d_0, d_1, ..., d_n, k]] = True
  
    and False elsewhere in `output`.
  
    For example, if `sp_input.dense_shape = [2, 3, 4]` with non-empty values:
  
        [0, 0, 0]: 0
        [0, 1, 0]: 10
        [1, 0, 3]: 103
        [1, 1, 2]: 150
        [1, 1, 3]: 149
        [1, 1, 4]: 150
        [1, 2, 1]: 121
  
    and `vocab_size = 200`, then the output will be a `[2, 3, 200]` dense bool
    tensor with False everywhere except at positions
  
        (0, 0, 0), (0, 1, 10), (1, 0, 103), (1, 1, 149), (1, 1, 150),
        (1, 2, 121).
  
    Note that repeats are allowed in the input SparseTensor.
    This op is useful for converting `SparseTensor`s into dense formats for
    compatibility with ops that expect dense tensors.
  
    The input `SparseTensor` must be in row-major order.
  
    Args:
      sp_input: A `SparseTensor` with `values` property of type `int32` or
        `int64`.
      vocab_size: A scalar int64 Tensor (or Python int) containing the new size
        of the last dimension, `all(0 <= sp_input.values < vocab_size)`.
      name: A name prefix for the returned tensors (optional)
  
    Returns:
      A dense bool indicator tensor representing the indices with specified value.
  
    Raises:
      TypeError: If `sp_input` is not a `SparseTensor`.
    """
    sp_input = _convert_to_sparse_tensor(sp_input)
  
    with ops.name_scope(name, "SparseToIndicator", [sp_input]) as name:
      num_entries = array_ops.shape(sp_input.indices)[0]
      new_values = array_ops.fill(array_ops.expand_dims(num_entries, 0), True)
      sp_values = sparse_tensor.SparseTensor(
          sp_input.indices, new_values, sp_input.dense_shape)
  
      sp_new = sparse_merge(sp_input, sp_values, vocab_size, name)
  
      # validate_indices may be False because we allow duplicates in new_indices:
      # repeated indices are allowed when creating an indicator matrix.
      return sparse_tensor_to_dense(
          sp_new, default_value=False, validate_indices=False, name=name)
function_tokens: def sparse_to_indicator ( sp_input , vocab_size , name = None ) : sp_input = _convert_to_sparse_tensor ( sp_input ) with ops . name_scope ( name , "SparseToIndicator" , [ sp_input ] ) as name : num_entries = array_ops . shape ( sp_input . indices ) [ 0 ] new_values = array_ops . fill ( array_ops . expand_dims ( num_entries , 0 ) , True ) sp_values = sparse_tensor . SparseTensor ( sp_input . indices , new_values , sp_input . dense_shape ) sp_new = sparse_merge ( sp_input , sp_values , vocab_size , name ) # validate_indices may be False because we allow duplicates in new_indices: # repeated indices are allowed when creating an indicator matrix. return sparse_tensor_to_dense ( sp_new , default_value = False , validate_indices = False , name = name )