m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorMarcin Chrzanowski <mc370754@students.mimuw.edu.pl>2021-05-27 21:05:36 +0200
committerMarcin Chrzanowski <mc370754@students.mimuw.edu.pl>2021-05-27 21:05:36 +0200
commit0fead7ba8062c5704b4a27c9a1c57427b6e8ecea (patch)
tree495814c1070aba7fdead59b8473b89c92aa92feb /util
parent0226b13c96e048282cc1d1868eaeb59fd89877b3 (diff)
Allow GPU use
Diffstat (limited to 'util')
-rw-r--r--util/util.py2
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)