Hi,
My data has multi labels in range of 1 to 4 labels per image.
I have been using one hot encoding of labels to obtain dataloader.
I am after few customised loss functions now, such as → 
class ArcFaceLoss(nn.modules.Module):
def init(self, s=30.0, m=0.5):
super().init()
self.crit = nn.CrossEntropyLoss()#DenseCrossEntropy()#BCEWithLogitsLoss()#
self.s = s
self.cos_m = math.cos(m)
self.sin_m = math.sin(m)
self.th = math.cos(math.pi - m)
self.mm = math.sin(math.pi - m) * m
def forward(self, logits, labels):
    logits = logits.float()
    cosine = logits
    sine = torch.sqrt(1.0 - torch.pow(cosine, 2))
    phi = cosine * self.cos_m - sine * self.sin_m
    phi = torch.where(cosine > self.th, phi, cosine - self.mm)

    output = (labels * phi) + ((1.0 - labels) * cosine)
    output *= self.s
    loss = self.crit(output, labels)
    return loss / 2

It seems, this loss function doesn’t take labels in one hot encoding, if i drop it, then i get an error
‘RuntimeError: stack expects each tensor to be equal size, but got [1] at entry 0 and [3] at entry 1’
May i know if there is any other way to obtain dataloader for multilabel data. Thank you.