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]`.
      >>> decode_libsvm(tf.constant(['1 1:1 2:2', '2 1:1 3:3']), 3, tf.float32, tf.int32)
      (<tf.Tensor: shape=(2,), dtype=int32, numpy=array([1, 2], dtype=int32)>, <tf.Tensor: shape=(2, 2), dtype=int64, numpy=array([[1, 2], [1, 3]])>, <tf.Tensor: shape=(2,), dtype=float32, numpy=array([1., 3.], dtype=float32)>, <tf.Tensor: shape=(2,), dtype=int64, numpy=array([2, 2]))>)
      """
      pass
  
output:     
      with tf.name_scope(name, "decode_libsvm", [input]):
          def split_line(line):
              parts = tf.strings.split(line, ' ')
              label = tf.strings.to_number(parts[0], label_dtype)
              indices = tf.strings.to_number(tf.strings.split(parts[1:], ':')[..., 0], tf.int64)
              values = tf.strings.to_number(tf.strings.split(parts[1:], ':')[..., 1], dtype)
              return label, indices, values
  
          labels, indices, values = tf.map_fn(split_line, input, dtype=(label_dtype, tf.int64, dtype))
  
          dense_shape = tf.shape(input)[0]
          sparse_indices = tf.reshape(indices, [-1])
          sparse_values = tf.reshape(values, [-1])
          sparse_shape = tf.stack([dense_shape, num_features])
  
          features = tf.sparse.SparseTensor(tf.transpose(tf.stack([tf.repeat(tf.range(dense_shape), tf.shape(indices)[1]), sparse_indices])), sparse_values, sparse_shape)
          features = tf.sparse.to_dense(features)
  
          return labels, features, tf.reduce_max(indices, axis=1) + 1, tf.shape(indices)[1]
  