diff options
Diffstat (limited to 'util')
-rw-r--r-- | util/__init__.py | 0 | ||||
-rw-r--r-- | util/util.py | 9 |
2 files changed, 9 insertions, 0 deletions
diff --git a/util/__init__.py b/util/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/util/__init__.py diff --git a/util/util.py b/util/util.py new file mode 100644 index 0000000..102ad93 --- /dev/null +++ b/util/util.py @@ -0,0 +1,9 @@ +import torch +import numpy as np + +def get_positional_encoding(n_positions, n_dimensions, device='cpu'): + # TODO: implement positional encoding + positional_encoding = np.zeros((n_positions, n_dimensions)) # placeholder + pass + # output shape: (seqlen, hiddendim) + return torch.tensor(positional_encoding, dtype=torch.float, device=device) |