parameters: (dense_tensor, ignore_value=None)
docstring: Converts dense `Tensor` to `SparseTensor`, dropping `ignore_value` cells.
  
    Args:
      dense_tensor: A `Tensor`.
      ignore_value: Entries in `dense_tensor` equal to this value will be
        absent from the return `SparseTensor`. If `None`, default value of
        `dense_tensor` dtype will be used (e.g. '' for `str`, 0 for `int`).
  
    Returns:
      A `SparseTensor` with the same shape as `dense_tensor`.
  
    Raises:
      ValueError: when `dense_tensor`'s rank is `None`.
docstring_summary: Converts dense `Tensor` to `SparseTensor`, dropping `ignore_value` cells.
docstring_tokens: Converts dense Tensor to SparseTensor dropping ignore_value cells .
function: def dense_to_sparse_tensor(dense_tensor, ignore_value=None):
    """Converts dense `Tensor` to `SparseTensor`, dropping `ignore_value` cells.
  
    Args:
      dense_tensor: A `Tensor`.
      ignore_value: Entries in `dense_tensor` equal to this value will be
        absent from the return `SparseTensor`. If `None`, default value of
        `dense_tensor` dtype will be used (e.g. '' for `str`, 0 for `int`).
  
    Returns:
      A `SparseTensor` with the same shape as `dense_tensor`.
  
    Raises:
      ValueError: when `dense_tensor`'s rank is `None`.
    """
    with ops.name_scope("DenseToSparseTensor"):
      dense_tensor = ops.convert_to_tensor(dense_tensor)
      ignore_value = _ignore_value_tensor(dense_tensor.dtype, ignore_value)
      indices = array_ops.where(
          math_ops.not_equal(dense_tensor, ignore_value), name="indices")
      return sparse_tensor.SparseTensor(
          indices=indices,
          values=array_ops.gather_nd(dense_tensor, indices, name="values"),
          dense_shape=array_ops.shape(
              dense_tensor, out_type=dtypes.int64, name="dense_shape"))
function_tokens: def dense_to_sparse_tensor ( dense_tensor , ignore_value = None ) : with ops . name_scope ( "DenseToSparseTensor" ) : dense_tensor = ops . convert_to_tensor ( dense_tensor ) ignore_value = _ignore_value_tensor ( dense_tensor . dtype , ignore_value ) indices = array_ops . where ( math_ops . not_equal ( dense_tensor , ignore_value ) , name = "indices" ) return sparse_tensor . SparseTensor ( indices = indices , values = array_ops . gather_nd ( dense_tensor , indices , name = "values" ) , dense_shape = array_ops . shape ( dense_tensor , out_type = dtypes . int64 , name = "dense_shape" ) )