We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents e31ff4c + 8595b43 commit 427373cCopy full SHA for 427373c
bert_pytorch/model/embedding/position.py
@@ -13,7 +13,7 @@ def __init__(self, d_model, max_len=512):
13
pe.require_grad = False
14
15
position = torch.arange(0, max_len).float().unsqueeze(1)
16
- div_term = (torch.arange(0, d_model, 2) * -(math.log(10000.0) / d_model)).float().exp()
+ div_term = (torch.arange(0, d_model, 2).float() * -(math.log(10000.0) / d_model)).exp()
17
18
pe[:, 0::2] = torch.sin(position * div_term)
19
pe[:, 1::2] = torch.cos(position * div_term)
0 commit comments