code: def target_list_to_sparse_tensor(target_list):
      
      indices = []
      vals = []
      for t_i, target in enumerate(target_list):
          for seq_i, val in enumerate(target):
              indices.append([t_i, seq_i])
              vals.append(val)
      shape = [len(target_list), np.asarray(indices).max(0)[1]+1]
      return (np.array(indices), np.array(vals), np.array(shape))
docs: Make tensorflow SparseTensor from list of targets, with each element in
      the list being a list or array with the values of the target sequence
      (e.g., the integer values of a character map for an ASR target string) See
      https://github.com/tensorflow/tensorflow/blob/master/tensorflow/
      contrib/ctc/ctc_loss_op_test.py for example of SparseTensor format