Skip to main content

Position embedding implemented in PyTorch

Project description

PyTorch Position Embedding

Travis Coverage

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


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 details)

Uploaded Source

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

Hashes for torch-position-embedding-0.8.0.tar.gz
Algorithm Hash digest
SHA256 00ba52e6740ca920569f235e87585c896f98fe6c60a7e38748c29290a7fbe402
MD5 48ed1a35a469d9b2bc451bd50455e8cb
BLAKE2b-256 5a0f77f7b780ae8c73c8aafc5eac1439472e469618c097e635169cd36c2dc13e

See more details on using hashes here.

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