Bug-fix RE random shift
This commit is contained in:
parent
f7c99ed1d1
commit
0601dd72fd
@ -978,7 +978,7 @@ class CompactRelPositionalEncoding(torch.nn.Module):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
shift = 0 if self.training else int(round(random.normalvariate(0, 1) * float(self.random_shift)))
|
shift = int(round(random.normalvariate(0, 1) * float(self.random_shift))) if self.training else 0
|
||||||
self.extend_pe(x, shift)
|
self.extend_pe(x, shift)
|
||||||
|
|
||||||
pos_emb = self.pe[
|
pos_emb = self.pe[
|
||||||
|
|||||||
Reference in New Issue
Block a user