Skip to content

Commit

Permalink
fix mask needing repeats for non-autoregressive case
Browse files Browse the repository at this point in the history
  • Loading branch information
lucidrains committed Aug 4, 2021
1 parent 575a416 commit cce1416
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion long_short_transformer/long_short_transformer.py
Expand Up @@ -167,7 +167,7 @@ def forward(self, x, mask = None):
pkv = self.to_dynamic_proj(gkv)

if exists(mask):
pmask = rearrange(mask, 'b (n s) -> b n s', s = s)
pmask = repeat(mask, 'b (n s) -> (b h) n s', s = s, h = h)
pkv.masked_fill_(~pmask[..., None], mask_value)

pkv = pkv.softmax(dim = -2)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -3,7 +3,7 @@
setup(
name = 'long-short-transformer',
packages = find_packages(),
version = '0.0.4',
version = '0.0.5',
license='MIT',
description = 'Long Short Transformer - Pytorch',
author = 'Phil Wang',
Expand Down

0 comments on commit cce1416

Please sign in to comment.