Skip to main content

PoPE

Project description

PoPE-pytorch (wip)

Efficient implementation (and explorations) into polar coordinate positional embedding (PoPE) - from Gopalakrishnan et al. under Schmidhuber

Install

$ pip install PoPE-pytorch

Usage

import torch
from PoPE_pytorch import PoPE

# define pope

pope = PoPE(64, heads = 8)

# pass in sequence length

pos_embed = pope(1024)

# queries and keys in attention

q = torch.randn(1, 8, 1024, 64)
k = torch.randn(1, 8, 1024, 64)

# training

rotated_q, rotated_k = pope.apply_pope_to_qk(pos_embed, q, k)

# inference

rotated_q, rotated_k = pope.apply_pope_to_qk(pos_embed, q[..., -1:, :], k)

Citations

@misc{gopalakrishnan2025decouplingwhatwherepolar,
    title   = {Decoupling the "What" and "Where" With Polar Coordinate Positional Embeddings}, 
    author  = {Anand Gopalakrishnan and Robert Csordás and Jürgen Schmidhuber and Michael C. Mozer},
    year    = {2025},
    eprint  = {2509.10534},
    archivePrefix = {arXiv},
    primaryClass = {cs.LG},
    url     = {https://arxiv.org/abs/2509.10534}, 
}

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

pope_pytorch-0.0.5.tar.gz (204.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pope_pytorch-0.0.5-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file pope_pytorch-0.0.5.tar.gz.

File metadata

  • Download URL: pope_pytorch-0.0.5.tar.gz
  • Upload date:
  • Size: 204.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for pope_pytorch-0.0.5.tar.gz
Algorithm Hash digest
SHA256 de07d41c94f4c07465ee04667e26ab47b4258b3bc8bf81da9a282c334c0480fc
MD5 291d66926498051edb9f11ee169952d5
BLAKE2b-256 3533c6e0928f29535cbf7ffddfa9cfd8e87856efb58f83f7b3a8b716be35e6a6

See more details on using hashes here.

File details

Details for the file pope_pytorch-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: pope_pytorch-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for pope_pytorch-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 630683b0820552e14ee146b4fe065c3633c8567b29d9d49dd0a649f1e702c98d
MD5 02d78dcdcc3be8bbc8205d90f645f3cc
BLAKE2b-256 45cb96ec856ee116e5fd3bc0da079d13577ca5a9ac0f752d576a4fb7f8f361ea

See more details on using hashes here.

Supported by

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