Position embedding implemented in PyTorch
Project description
PyTorch Position Embedding
Install
pip install torch-position-embedding
Usage
from torch_position_embedding import PositionEmbedding
PositionEmbedding(num_embeddings=5, embedding_dim=10, mode=PositionEmbedding.MODE_ADD)
Modes:
MODE_EXPAND
: negative indices could be used to represent relative positions.MODE_ADD
: add position embedding to the original tensor.MODE_CAT
: concatenate position embedding to the original tensor.
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
File details
Details for the file torch-position-embedding-0.8.0.tar.gz
.
File metadata
- Download URL: torch-position-embedding-0.8.0.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 00ba52e6740ca920569f235e87585c896f98fe6c60a7e38748c29290a7fbe402 |
|
MD5 | 48ed1a35a469d9b2bc451bd50455e8cb |
|
BLAKE2b-256 | 5a0f77f7b780ae8c73c8aafc5eac1439472e469618c097e635169cd36c2dc13e |