class_docstr: A class for decoding labels using the idea of siamese networks / bi-encoders. This can be used for all classification tasks in flair.
  
  Args:
      label_encoder (flair.embeddings.TokenEmbeddings):
          The label encoder used to encode the labels into an embedding.
      label_dictionary (flair.data.Dictionary):
          The label dictionary containing the mapping between labels and indices.
  
  Attributes:
      label_encoder (flair.embeddings.TokenEmbeddings):
          The label encoder used to encode the labels into an embedding.
      label_dictionary (flair.data.Dictionary):
          The label dictionary containing the mapping between labels and indices.
  
  Methods:
      forward(self, label_embeddings: torch.Tensor, context_embeddings: torch.Tensor) -> torch.Tensor:
          Takes the label embeddings and context embeddings as input and returns a tensor of label scores.
  
  Examples:
      label_dictionary = corpus.make_label_dictionary("ner")
      label_encoder = TransformerWordEmbeddings('bert-base-ucnased')
      label_verbalizer_decoder = LabelVerbalizerDecoder(label_encoder, label_dictionary)
class_docstr_tok: ["A","class","for","decoding","labels","using","the","idea","of","siamese","networks","\/","bi-encoders",".","This","can","be","used","for","all","classification","tasks","in","flair",".","Args",":","label_encoder","(","flair.embeddings.TokenEmbeddings",")",":","The","label","encoder","used","to","encode","the","labels","into","an","embedding",".","label_dictionary","(","flair.data.Dictionary",")",":","The","label","dictionary","containing","the","mapping","between","labels","and","indices",".","Attributes",":","label_encoder","(","flair.embeddings.TokenEmbeddings",")",":","The","label","encoder","used","to","encode","the","labels","into","an","embedding",".","label_dictionary","(","flair.data.Dictionary",")",":","The","label","dictionary","containing","the","mapping","between","labels","and","indices",".","Methods",":","forward","(","self",",","label_embeddings",":","torch.Tensor",",","context_embeddings",":","torch.Tensor",")","-",">","torch.Tensor",":","Takes","the","label","embeddings","and","context","embeddings","as","input","and","returns","a","tensor","of","label","scores",".","Examples",":","label_dictionary","=","corpus.make_label_dictionary","(","``","ner","''",")","label_encoder","=","TransformerWordEmbeddings","(","'bert-base-ucnased","'",")","label_verbalizer_decoder","=","LabelVerbalizerDecoder","(","label_encoder",",","label_dictionary",")"]
docstr: Forward pass of the label verbalizer decoder.
  
  Args:
      inputs (torch.Tensor): The input tensor.
  
  Returns:
      The scores of the decoder.
  
  Raises:
      RuntimeError: If an unknown decoding type is specified.
docstr_tok: ["Forward","pass","of","the","label","verbalizer","decoder",".","Args",":","inputs","(","torch.Tensor",")",":","The","input","tensor",".","Returns",":","The","scores","of","the","decoder",".","Raises",":","RuntimeError",":","If","an","unknown","decoding","type","is","specified","."]
code: def forward(self, inputs: torch.Tensor) -> torch.Tensor:
      """Forward pass of the label verbalizer decoder.
  
      Args:
          inputs (torch.Tensor): The input tensor.
  
      Returns:
          The scores of the decoder.
  
      Raises:
          RuntimeError: If an unknown decoding type is specified.
      """
      if (
          self.training
          or not self.label_embedding._everything_embedded(
              self.verbalized_labels
          )
      ):
          self.label_embedding.embed(self.verbalized_labels)
  
      label_tensor = torch.stack(
          [label.get_embedding() for label in self.verbalized_labels]
      )
  
      if self.training:
          store_embeddings(self.verbalized_labels, "none")
  
      scores = torch.mm(inputs, label_tensor.T)
  
      return scores
  
file_path: flair/flair/nn/decoder.py
imports: import logging
  from typing import List, Optional
  import torch
  import flair
  from flair.data import Dictionary, Sentence
  from flair.embeddings import Embeddings
  from flair.nn.distance import CosineDistance, EuclideanDistance, HyperbolicDistance, LogitCosineDistance, NegativeScaledDotProduct
  from flair.training_utils import store_embeddings
label_desc: Use image node_id 3 for calling the LabelVerbalizerDecoder obj's underlying member method code with example usage: obj.forward(inputs) and returns: scores