Skip to main content

g2n — a torch.compile backend that pays attention

Open-core PyTorch compiler: custom FX fusion passes, a Triton LayerNorm kernel, and license-gated Inductor tuning. Plus g2n.quantum, a statevector quantum circuit simulator (classical simulation — not quantum hardware).

pip install g2n torch
import torch, g2n

compiled = g2n.compile(model)     # == torch.compile(model, backend="g2n")
y = compiled(x)

Free (Community) gives you the g2n fusion passes on stock Inductor and quantum circuits up to 24 qubits. A license key unlocks more — activation is one command and then fully offline:

export G2N_LICENSE_KEY=G2N-XXXX-XXXX-XXXX
g2n activate && g2n status
Unlock Tier
Persistent compile cache (warmup once per machine, not per run) Pro
Enhanced planner: epilogue fusion + custom Triton kernels Pro
Serving platform (pip install g2n-enterprise): registry, HTTP node, quantization incl. weight-only int8, CUDA graphs Pro
Quantum: unlimited qubits + circuit fusion Pro
max-autotune, dynamic batching, batched quantum sweeps, model zoo Enterprise

Quantum in 20 seconds

import g2n.quantum as qf
c = qf.Circuit(2).h(0).cnot(0, 1)      # Bell state
c.measure_all(shots=1000)              # {'00': ~500, '11': ~500}
c.expectation("ZZ")                    # tensor(1.)

Guarantees

  • Never worse than eager: any compile failure returns your unmodified model with a one-line warning.
  • Offline after activation: license tokens are Ed25519-verified locally; no phone-home during runs.
  • Honest numbers: no benchmark claim without named hardware and a script to reproduce it — including on your own machine.

Docs, pricing, benchmarks: g2n.dev · full manual in the repo's docs/.

Download files

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

Source Distribution

g2n-1.2.0.tar.gz (24.3 kB view details)

Uploaded Source

Built Distribution

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

g2n-1.2.0-py3-none-any.whl (23.1 kB view details)

Uploaded Python 3

File details

Details for the file g2n-1.2.0.tar.gz.

File metadata

  • Download URL: g2n-1.2.0.tar.gz
  • Upload date:
  • Size: 24.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for g2n-1.2.0.tar.gz
Algorithm Hash digest
SHA256 9cb55f3b05d19219bc1a0da19608d2a55edcc2b0632176e6f270efa929ce9d7f
MD5 90708b68a20b81502e23700247c16073
BLAKE2b-256 dd0da501e87b8ef4c1ba87fcb66dfb87741a69d7b8a319cb5f55103fcf8417dd

See more details on using hashes here.

File details

Details for the file g2n-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: g2n-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 23.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for g2n-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3f0f667b5a1bd47c23175a8e96967efa4f447b10b1a3c8f3bdcbbcb9441c859a
MD5 c2c717d2ee34b4caba8c74167606025e
BLAKE2b-256 826dcf6d4423602eca3821c01f3441b122d7fdc5ccc6f65c829ccd9d1bee1b98

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