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.8.0.tar.gz (2.7 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page