code: def token_labels_to_subtoken_labels(labels, y_mask, input_mask):
      subtoken_labels = []
      labels_ind = 0
      n_tokens_with_special = int(np.sum(input_mask))
  
      for el in y_mask[1 : n_tokens_with_special - 1]:
          if el == 1:
              subtoken_labels += [labels[labels_ind]]
              labels_ind += 1
          else:
              subtoken_labels += [labels[labels_ind - 1]]
  
      subtoken_labels = (
          [0]
          + subtoken_labels
          + [0] * (len(input_mask) - n_tokens_with_special + 1)
      )
      return subtoken_labels
  
file_path: DeepPavlov/deeppavlov/models/torch_bert/torch_transformers_sequence_tagger.py
imports: from logging import getLogger
  from pathlib import Path
  from typing import List, Union, Dict, Optional, Tuple
  import numpy
  import torch
  from transformers import AutoModelForTokenClassification, AutoConfig
  from deeppavlov.core.commands.utils import expand_path
  from deeppavlov.core.common.errors import ConfigError
  from deeppavlov.core.common.registry import register
  from deeppavlov.core.models.torch_model import TorchModel
  from deeppavlov.models.torch_bert.crf import CRF
label_desc: Use image node_id 2 for calling a global function with example usage: token_labels_to_subtoken_labels(labels, y_mask, input_mask) and returns: subtoken_labels