class liqfit.modeling.LabelClassificationHead

(in_features: int, out_features: int, multi_target: bool, bias: bool = True,
temperature: int = 1.0, eps: float = 1e-5)


  • in_features (int) Number of input features.

  • out_features (int) Number of output features.

  • multi_target (bool): Whether the output is multi-target or not (used for loss calculation).

  • bias (bool): Whether to use bias in the nn.Linear layer or not.

  • temperature (int): Temperature that will be divided by the linear layer output to calibrate the output. (Defaults to 1.0)

  • eps (float): Epsilon will be added to the temperature for numerical stability. (Defaults to 1e-5).

Using LabelClassificationHead

from liqfit.modeling.heads import LabelClassificationHead
import torch

head = LabelClassificationHead(512, 20, multi_target=True)
embeddings = torch.randn((1, 10, 512))
output = head(embeddings)

Last updated