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.2.tar.gz (203.9 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.2-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pope_pytorch-0.0.2.tar.gz
  • Upload date:
  • Size: 203.9 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.2.tar.gz
Algorithm Hash digest
SHA256 af47557a416578bb5f083e79f7cbb9d57af74931c8bf81a8980224af70fb8f15
MD5 f9cb27159ae0bf78d7f1c2d66a130e6f
BLAKE2b-256 2b3466a99d8e0ca4b50e700cdfadff432ec408d571e5369e59bd9645f457dc28

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pope_pytorch-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.8 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 12cd63a78a0e695fe38a8481c8e6649123d9a5505538990024e38ffc8cfd4a94
MD5 20e904ce199e2c2adabfb3453c5a53c4
BLAKE2b-256 16654f84d9dda83f8804f43f3b0c2d33baeea2c64e7fee7e3ef951b862d51e40

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