1D, 2D, and 3D Sinusodal Positional Encodings in PyTorch
Project description
1D, 2D, and 3D Sinusodal Postional Encoding Pytorch
This is an implemenation of 1D, 2D, and 3D sinusodal positional encoding, being
able to encode on tensors of the form (batchsize, x, ch)
, (batchsize, x, y, ch)
, and (batchsize, x, y, z, ch)
, where the positional encodings will be
added to the ch
dimension. The Attention is All You
Need allowed for positional encoding in
only one dimension, however, this works to extend this to 2 and 3 dimensions.
New: This also works on tensors of the form (batchsize, ch, x)
, etc. For
inputs of this type, include the word Permute
before the number in the class;
e.g. for a 1D input of size (batchsize, ch, x)
, do
PositionalEncodingPermute1D
instead of PositionalEncoding1D
.
To install, simply run:
pip install positional-encodings
For more information, check out the GitHub Page
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for positional_encodings-2.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 081f5916de5096aab0a261e454800b810c9f96a3c31d7edf67c5cb57cc021e35 |
|
MD5 | 9fa36d9592574c3e1e7b0663a3973d93 |
|
BLAKE2b-256 | 9f65be5d5d4f27f1e1fc3c5e129c9e2576a15aaa40d942236e566446b48597be |
Hashes for positional_encodings-2.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c592108832f10bb9156685ef971eddc02a19cae2064c75aef2f4a5eea69c1024 |
|
MD5 | daec5d945a545d8ea9f8eeeac8a6b077 |
|
BLAKE2b-256 | 461f7d1f2ab5638504f7d38a9749f824ae68f0cc06c6f39dd7725e78cf472e8b |