Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/alpha0.0.1a4' into alpha0.0.1a4
Browse files Browse the repository at this point in the history
  • Loading branch information
codertimo committed Oct 23, 2018
2 parents e31ff4c + 8595b43 commit 427373c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bert_pytorch/model/embedding/position.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def __init__(self, d_model, max_len=512):
pe.require_grad = False

position = torch.arange(0, max_len).float().unsqueeze(1)
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()

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

0 comments on commit 427373c

Please sign in to comment.