Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
Fix masked_fill no-op (#3068)
Browse files Browse the repository at this point in the history
Issue with using the out-of-place version of .masked_fill()
  • Loading branch information
EricMichaelSmith authored Sep 10, 2020
1 parent 5265587 commit 84351e5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion parlai/agents/transformer/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -1258,7 +1258,7 @@ def forward(self, xs, ys, mask_ys=None, values=None):
if mask_ys is not None:
attn_mask = (mask_ys == 0).view(bsz, 1, y_len)
attn_mask = attn_mask.repeat(1, x_len, 1)
l1.masked_fill(attn_mask, neginf(l1.dtype))
l1.masked_fill_(attn_mask, neginf(l1.dtype))
l2 = F.softmax(l1, dim=self.dim, dtype=torch.float).type_as(l1)
if values is None:
values = ys
Expand Down

0 comments on commit 84351e5

Please sign in to comment.