Skip to content

Commit 8c647e6

Browse files
authored
Merge pull request codertimo#24 from zhupengjia/develop
fixed a bug in position.py
2 parents c897384 + 6521dfe commit 8c647e6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bert_pytorch/model/embedding/position.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def __init__(self, d_model, max_len=512):
1313
pe.require_grad = False
1414

1515
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()
16+
div_term = (torch.arange(0, d_model, 2).float() * -(math.log(10000.0) / d_model)).exp()
1717

1818
pe[:, 0::2] = torch.sin(position * div_term)
1919
pe[:, 1::2] = torch.cos(position * div_term)

0 commit comments

Comments
 (0)