From 0fead7ba8062c5704b4a27c9a1c57427b6e8ecea Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Thu, 27 May 2021 21:05:36 +0200 Subject: Allow GPU use --- util/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util') 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) -- cgit v1.2.3