Browse Source

修复CrossEntropy未使用class_in_dim的bug

tags/v0.5.5
yh 5 years ago
parent
commit
bf800dc304
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      fastNLP/core/losses.py

+ 1
- 1
fastNLP/core/losses.py View File

@@ -237,7 +237,7 @@ class CrossEntropyLoss(LossBase):
if pred.size(1) != target.size(1): # 有可能顺序替换了
pred = pred.transpose(1, 2)
else:
pred = pred.transpose(1, 2)
pred = pred.transpose(-1, self.class_in_dim)
pred = pred.reshape(-1, pred.size(-1))
target = target.reshape(-1)



Loading…
Cancel
Save