Merge pull request #139 from fastnlp/choosewhatulike-patch-1

fix mask bug in star-transformer
This commit is contained in:
Yunfan Shao 2019-03-23 13:31:04 +08:00 committed by GitHub
commit 56410c9e31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,6 +46,7 @@ class StarTransformer(nn.Module):
return f(x.permute(0, 2, 3, 1)).permute(0, 3, 1, 2)
B, L, H = data.size()
mask = (mask == 0) # flip the mask for masked_fill_
smask = torch.cat([torch.zeros(B, 1, ).byte().to(mask), mask], 1)
embs = data.permute(0, 2, 1)[:,:,:,None] # B H L 1