fix: there may not be weight ratio in multilabel dataset label (#3226)

This commit is contained in:
Tingquan Gao 2024-08-23 11:35:56 +08:00 committed by GitHub
parent 666ca9bbd1
commit bc9401f861
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -39,7 +39,7 @@ class MultiLabelLoss(nn.Layer):
def _binary_crossentropy(self, input, target, class_num):
if self.weight_ratio:
target, label_ratio = target[:, 0, :], target[:, 1, :]
else:
elif target.ndim == 3:
target = target[:, 0, :]
if self.epsilon is not None:
target = self._labelsmoothing(target, class_num)