input: 
  from typing import List, Tuple
  import tensorflow as tf
  
  def decode_libsvm(input: tf.Tensor, num_features: int, dtype: tf.DType = tf.float32, label_dtype: tf.DType = tf.int64, name: str = None) -> Tuple[tf.Tensor, tf.Tensor, tf.Tensor, tf.Tensor]:
      """Convert LibSVM input to tensors. The output consists of
  
      a label and a feature tensor. The shape of the label tensor
      is the same as input and the shape of the feature tensor is
      `[input_shape, num_features]`.
  
      >>> input_data = tf.constant(["1 2:1 3:2", "2 1:3 4:4"], dtype=tf.string)
      >>> result = decode_libsvm(input_data, num_features=4)
      >>> with tf.Session() as sess:
      ...     print(sess.run(result))
      (array([1, 2], dtype=int64), 
       array([[0, 2], [0, 3], [1, 1], [1, 4]], dtype=int64), 
       array([1., 2., 3., 4.], dtype=float32), 
       array([2], dtype=int64))
      """
  
output:     
      def parse_line(line):
          parts = tf.string_split([line], ' ')
          label = tf.string_to_number(parts.values[0], out_type=label_dtype)
          indices = tf.string_to_number(tf.string_split(parts.values[1:], ':').values, out_type=tf.int64)
          indices = tf.reshape(indices, [-1, 2])
          values = tf.string_to_number(tf.string_split(parts.values[1:], ':').indices[:, 1], out_type=dtype)
          return label, indices, values
  
      labels, indices, values = tf.map_fn(parse_line, input, dtype=(label_dtype, tf.int64, dtype))
  
      dense_shape = tf.stack([tf.shape(input)[0], num_features])
      sparse_indices = tf.reshape(indices, [-1, 2])
      sparse_values = tf.reshape(values, [-1])
      sparse_shape = tf.stack([tf.shape(input)[0], num_features])
  
      features = tf.SparseTensor(sparse_indices, sparse_values, sparse_shape)
      features = tf.sparse_tensor_to_dense(features, default_value=0)
  
      unique_indices = tf.unique(indices[:, 0])[0]
  
      return labels, features, values, unique_indices
  