parameters: (self, input_tensor)
return_statement: return input_tensor
docstring: sparsify input_tensor if dense.
docstring_summary: sparsify input_tensor if dense.
docstring_tokens: sparsify input_tensor if dense .
function: def _get_input_sparse_tensor(self, input_tensor):
      """sparsify input_tensor if dense."""
      if not isinstance(input_tensor, sparse_tensor_py.SparseTensor):
        # To avoid making any assumptions about which values are to be ignored,
        # we set ignore_value to -1 for numeric tensors to avoid excluding valid
        # indices.
        if input_tensor.dtype == dtypes.string:
          ignore_value = ""
        else:
          ignore_value = -1
        input_tensor = _reshape_real_valued_tensor(input_tensor, 2, self.name)
        input_tensor = contrib_sparse_ops.dense_to_sparse_tensor(
            input_tensor, ignore_value=ignore_value)
  
      return input_tensor
function_tokens: def _get_input_sparse_tensor ( self , input_tensor ) : if not isinstance ( input_tensor , sparse_tensor_py . SparseTensor ) : # To avoid making any assumptions about which values are to be ignored, # we set ignore_value to -1 for numeric tensors to avoid excluding valid # indices. if input_tensor . dtype == dtypes . string : ignore_value = "" else : ignore_value = - 1 input_tensor = _reshape_real_valued_tensor ( input_tensor , 2 , self . name ) input_tensor = contrib_sparse_ops . dense_to_sparse_tensor ( input_tensor , ignore_value = ignore_value ) return input_tensor