Multi-label text calssfication

Hello, I would like to ask, what is the format of multi-label text classification pytorch for output data processing? I am a newbie and feel the lack of information.

A multi-label classification (in my understanding) means that each output can belong to more than a single class.
Is that correct or are you dealing with a multi-class classification, where each output belongs to exactly one particular target class?

For text classification I guess your output would most likely have the shape [batch_size, nb_classes, seq_length].
Depending on your actual use case (multi-label vs. multi-class):

  • multi-label: your target should have the same shape as your output and you would use e.g. nn.BCEWithLogitsLoss as the criterion
  • multi-class: your target have the shape [batch_size, seq_length] and contain the class indices in the range [0, nb_classes-1].