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.6.0.tar.gz (30.7 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.6.0-py3-none-any.whl (26.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for g2n-1.6.0.tar.gz
Algorithm Hash digest
SHA256 14c6120f8fc709dab75de778dabc6e127939b82bb25d129a836913b0d410b97b
MD5 098e5193921340615b76151b779f71ea
BLAKE2b-256 fbb9fa98081e2617985621e81d8c33d0aeddd48e1b9be95237f61c69d5476e9f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: g2n-1.6.0-py3-none-any.whl
  • Upload date:
  • Size: 26.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.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ac00a96cc6dabf35052278ac89580ec0334540484b85706a92d062baf33ec988
MD5 ee0b668cf0936f7dced7cd094fa31fdf
BLAKE2b-256 348fd8cc40cf68b31f938360ecf3dbf64b31dcd8bde4ffcafcab5492cd0f570c

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