Skip to content

Commit

Permalink
fix l r
Browse files Browse the repository at this point in the history
  • Loading branch information
Mddct committed Jun 4, 2024
1 parent 27d06f0 commit 1214a47
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion wenet/transformer/attention.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ def _relative_indices(self, query_length: int, key_length: int,
device: torch.device):
l_indices = torch.arange(query_length, device=device).view(-1, 1)
r_indices = torch.arange(key_length, device=device).view(1, -1)
rel_indices = l_indices - r_indices
rel_indices = r_indices - l_indices
rel_indices = torch.clamp(rel_indices, -self.max_left_rel_pos,
self.max_right_rel_pos)
return rel_indices + self.max_left_rel_pos
Expand Down

0 comments on commit 1214a47

Please sign in to comment.