Skip to main content

Position embedding implemented in PyTorch

Project description

PyTorch Position Embedding

Travis Coverage


pip install torch-position-embedding


from torch_position-embedding import PositionEmbedding

PositionEmbedding(num_embeddings=5, embedding_dim=10, mode=PositionEmbedding.MODE_ADD)


  • 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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

torch-position-embedding-0.7.1.tar.gz (3.2 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page