mirror of
https://github.com/wassname/pytorch-ts.git
synced 2026-09-11 12:42:03 +08:00
fix mask
TODO check this
This commit is contained in:
@@ -213,10 +213,7 @@ class TransformerNetwork(nn.Module):
|
||||
|
||||
@staticmethod
|
||||
def upper_triangular_mask(d):
|
||||
mask = torch.zeros_like(torch.eye(d))
|
||||
for k in range(d - 1):
|
||||
mask = mask + torch.eye(d, d, k + 1)
|
||||
return mask
|
||||
return torch.triu(torch.ones((d,d)))
|
||||
|
||||
|
||||
class TransformerTrainingNetwork(TransformerNetwork):
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user