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

release/2.5.2
Tingquan Gao 2024-08-23 11:51:43 +08:00 committed by GitHub
parent 1b99736b14
commit d1634d4702
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

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)