Unverified Commit f427e750 authored by Yih-Dar's avatar Yih-Dar Committed by GitHub
Browse files

use mean instead of elementwise_mean in XLMPredLayer (#15436)



* use mean instead of elementwise_mean

* make style
Co-authored-by: default avatarydshieh <ydshieh@users.noreply.github.com>
parent 7b8bdd86
......@@ -659,9 +659,7 @@ class XLMPredLayer(nn.Module):
scores = self.proj(x)
outputs = (scores,) + outputs
if y is not None:
loss = nn.functional.cross_entropy(
scores.view(-1, self.n_words), y.view(-1), reduction="elementwise_mean"
)
loss = nn.functional.cross_entropy(scores.view(-1, self.n_words), y.view(-1), reduction="mean")
outputs = (loss,) + outputs
else:
scores = self.proj.log_prob(x)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment