input: from typing import List, Tuple
  
  def decode_libsvm(input: List[str], num_features: int, dtype=tf.float32, label_dtype=tf.int64, name=None) -> Tuple[tf.Tensor, tf.Tensor, tf.Tensor, tf.Tensor]:
      """Convert LibSVM input to tensors.
  
      Args:
          input: A list of strings where each string is a record in the LibSVM format.
          num_features: A positive integer representing the number of features.
          dtype: An optional TensorFlow dtype for the feature values. Defaults to tf.float32.
          label_dtype: An optional TensorFlow dtype for the labels. Defaults to tf.int64.
          name: An optional name for the operation.
  
      Returns:
          A tuple of tensors (label, feature_indices, feature_values, feature_shape).
  
          label: A tensor of type label_dtype.
          feature_indices: A 2-D tensor of type int64.
          feature_values: A 1-D tensor of type dtype.
          feature_shape: A 1-D tensor of type int64.
  
      >>> inputs = ['1 1:1.0 2:2.0', '2 1:0.5 3:3.0']
      >>> result = decode_libsvm(inputs, 3, dtype=tf.float32, label_dtype=tf.int32)
      >>> result[0].numpy()  # Labels
      array([1, 2], dtype=int32)
      >>> result[1].numpy()  # Feature indices
      array([[0, 1],
             [0, 2],
             [1, 1],
             [1, 3]], dtype=int64)
      >>> result[2].numpy()  # Feature values
      array([1. , 2. , 0.5, 3. ], dtype=float32)
      >>> result[3].numpy()  # Feature shape
      array([2, 3], dtype=int64)
      """
output:     labels = []
      indices = []
      values = []
  
      for i, line in enumerate(input):
          parts = line.split()
          labels.append(int(parts[0]))
          for part in parts[1:]:
              idx, val = part.split(':')
              indices.append([i, int(idx) - 1])
              values.append(float(val))
  
      labels = tf.constant(labels, dtype=label_dtype)
      indices = tf.constant(indices, dtype=tf.int64)
      values = tf.constant(values, dtype=dtype)
      shape = tf.constant([len(input), num_features], dtype=tf.int64)
  
      return labels, indices, values, shape