diff options
author | Marcin Chrzanowski <mc370754@students.mimuw.edu.pl> | 2021-05-27 21:05:36 +0200 |
---|---|---|
committer | Marcin Chrzanowski <mc370754@students.mimuw.edu.pl> | 2021-05-27 21:05:36 +0200 |
commit | 0fead7ba8062c5704b4a27c9a1c57427b6e8ecea (patch) | |
tree | 495814c1070aba7fdead59b8473b89c92aa92feb /util | |
parent | 0226b13c96e048282cc1d1868eaeb59fd89877b3 (diff) |
Allow GPU use
Diffstat (limited to 'util')
-rw-r--r-- | util/util.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/util/util.py b/util/util.py index 65f1838..bb9e0c3 100644 --- a/util/util.py +++ b/util/util.py @@ -14,4 +14,4 @@ def get_positional_encoding(n_positions, n_dimensions, device='cpu'): positional_encoding[:, ::2] = torch.sin(positional_encoding[:, ::2]) positional_encoding[:, 1::2] = torch.cos(positional_encoding[:, 1::2]) # output shape: (seqlen, hiddendim) - return positional_encoding + return positional_encoding.to(device) |