Skip to content

Commit 6f556fe

Browse files
author
gongel
authored
fix: softmax_with_cross_entropy --> cross_entropy (#580)
1 parent 56fc422 commit 6f556fe

File tree

1 file changed

+3
-2
lines changed
  • examples/simultaneous_translation/stacl

1 file changed

+3
-2
lines changed

examples/simultaneous_translation/stacl/model.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@ def forward(self, predict, label):
3737
x=label, num_classes=predict.shape[-1]),
3838
epsilon=self.label_smooth_eps)
3939

40-
cost = F.softmax_with_cross_entropy(
41-
logits=predict,
40+
cost = F.cross_entropy(
41+
input=predict,
4242
label=label,
43+
reduction='none',
4344
soft_label=True if self.label_smooth_eps else False).squeeze()
4445
weighted_cost = cost * weights
4546
sum_cost = paddle.sum(weighted_cost)

0 commit comments

Comments
 (0)