SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2205.10091 · 2022

TensorCircuit: a Quantum Software Framework for the NISQ Era

arXiv · PDF · Open in the Atlas

Code that ran

3 of 5 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 0 failures of our instrument; 2 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2205.10091.json · badge: /api/ran/2205.10091.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
tensorcircuit/tensorcircuit-ng canonical (classifier label)
classifier basis not recorded on the link
3 ran · 2 no recorded run
FunctionStatusWhere it lives
cite Ran
ran on a synthesized input
tensorcircuit/tensorcircuit-ng/tensorcircuit/about.py
code served (permissive licence) · get_code("417eea44d0dfc073")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

# The cite function takes a single parameter: format (str)
# It checks if format equals 'bib' or 'aps', otherwise raises ValueError
# We'll test with the default 'bib' format

ARGS = {
    'format': 'bib'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
qng Ran
ran on a synthesized input
tensorcircuit/tensorcircuit-ng/tensorcircuit/experimental.py
code served (permissive licence) · get_code("35be0f52f73e8073")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned function. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
from typing import Any, Callable, Optional

torch.manual_seed(0)

# Mock backend module to simulate tensorcircuit backend
class MockBackend:
    def eye(self, n, dtype):
        return torch.eye(n, dtype=dtype)
    
    def real(self, t):
        return torch.real(t)
    
    def tensordot(self, a, b, axes):
        return torch.tensordot(a, b, dims=axes)
    
    def conj(self, t):
        return torch.conj(t)
    
    def transpose(self, t):
        return torch.transpose(t, 0, 1)
    
    def cast(self, t, dtype):
        if dtype == 'complex64':
            return t.to(torch.complex64)
        elif dtype == 'complex128':
            return t.to(torch.complex128)
        return t
    
    def jacfwd(self, f):
        def jacobian_fwd(params):
            params.requires_grad_(True)
            outputs = f(params)
            jac_list = []
            for i in range(outputs.shape[0]):
                if params.grad is not None:
                    params.grad.zero_()
                outputs[i].backward(retain_graph=True)
                jac_list.append(params.grad.clone())
            return torch.stack(jac_list)
        return jacobian_fwd
    
    def jacrev(self, f):
        def jacobian_rev(params):
            params.requires_grad_(True)
            outputs = f(params)
            jac_list = []
            for i in range(outputs.shape[0]):
                if params.grad is not None:
                    params.grad.zero_()
                outputs[i].backward(retain_graph=True)
                jac_list.append(params.grad.clone())
            return torch.stack(jac_list)
        return jacobian_rev
    
    def vmap(self, f, vectorized_argnums):
        if vectorized_argnums == 0:
            def vmapped(x, y=None):
                if y is None:
                    return torch.stack([f(x[i]) for i in range(x.shape[0])])
                else:
                    return torch.stack([f(x[i], y) for i in range(x.shape[0])])
            return vmapped
        elif vectorized_argnums == 1:
            def vmapped_1(x, y):
                return torch.stack([f(x, y[:, i]) for i in range(y.shape[1])])
            return vmapped_1

backend = MockBackend()
dtypestr = 'complex128'

# Define a simple quantum circuit function
def simple_ansatz(params: torch.Tensor) -> torch.Tensor:
    """Simple parameterized quantum function returning a state vector."""
    # Simulate a quantum state based on parameters
    # Returns a complex vector of dimension 4
    batch_size = 4
    state = torch.zeros(batch_size, dtype=torch.complex128)
    # Simple construction: angle-dependent superposition
    theta1 = params[0] if params.shape[0] > 0 else torch.tensor(0.0, dtype=torch.complex128)
    theta2 = params[1] if params.shape[0] > 1 else torch.tensor(0.0, dtype=torch.complex128)
    
    state[0] = torch.cos(theta1)
    state[1] = torch.sin(theta1) * torch.exp(1j * theta2)
    state[2] = torch.sin(theta1) * torch.cos(theta2)
    state[3] = torch.sin(theta1) * torch.sin(theta2)
    
    # Normalize
    norm = torch.sqrt(torch.sum(torch.abs(state) ** 2))
    return state / norm

# Parameters for qng function
params = torch.tensor([0.5, 0.8], dtype=torch.complex128)

ARGS = {
    'f': simple_ansatz,
    'kernel': 'qng',
    'postprocess': 'qng',
    'mode': 'fwd'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
qng2 Ran
ran on a synthesized input
tensorcircuit/tensorcircuit-ng/tensorcircuit/experimental.py
code served (permissive licence) · get_code("010b93c2f4ba9ea1")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned function. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from functools import partial
from typing import Any, Callable

torch.manual_seed(0)

# Mock backend module since it's used throughout
class MockBackend:
    def copy(self, x):
        return x.clone() if hasattr(x, 'clone') else x
    
    def stop_gradient(self, x):
        return x.detach()
    
    def eye(self, n, dtype=None):
        return torch.eye(n, dtype=dtype)
    
    def real(self, x):
        return torch.real(x) if torch.is_complex(x) else x
    
    def tensordot(self, a, b, axes):
        return torch.tensordot(a, b, dims=axes)
    
    def conj(self, x):
        return torch.conj(x) if torch.is_complex(x) else x
    
    def vjp(self, f, x, v):
        x_req = x.clone().detach().requires_grad_(True)
        y = f(x_req)
        y.backward(v if v.shape == y.shape else torch.ones_like(y))
        return y, x_req.grad
    
    def jacfwd(self, f):
        def jacobian_fwd(x):
            batch_size = x.shape[0] if x.dim() > 0 else 1
            x_expanded = x.unsqueeze(0).expand(batch_size, *x.shape)
            results = []
            for i in range(batch_size):
                x_i = x_expanded[i].clone().detach().requires_grad_(True)
                y_i = f(x_i)
                if y_i.requires_grad:
                    y_i.backward(torch.ones_like(y_i), retain_graph=True)
                    results.append(x_i.grad.clone() if x_i.grad is not None else torch.zeros_like(x_i))
                else:
                    results.append(torch.zeros_like(x_i))
            return torch.stack(results)
        return jacobian_fwd
    
    def jacrev(self, f):
        def jacobian_rev(x):
            batch_size = x.shape[0] if x.dim() > 0 else 1
            results = []
            for i in range(batch_size):
                x_i = x.clone().detach().requires_grad_(True)
                y_i = f(x_i)
                if y_i.requires_grad:
                    y_i.backward(torch.ones_like(y_i), retain_graph=True)
                    results.append(x_i.grad.clone() if x_i.grad is not None else torch.zeros_like(x_i))
                else:
                    results.append(torch.zeros_like(x_i))
            return torch.stack(results)
        return jacobian_rev

backend = MockBackend()

# Define a simple quantum state function
def quantum_state_function(params: torch.Tensor) -> torch.Tensor:
    """Returns a quantum state vector as a complex tensor."""
    batch_size = params.shape[0] if params.dim() > 0 else 1
    # Return a simple complex state vector of size 4
    state = torch.ones(4, dtype=torch.complex64)
    state = state * (params.sum() if params.dim() > 0 else params)
    return state

# Create ARGS dictionary with all parameters for qng2
ARGS = {
    'f': quantum_state_function,
    'kernel': 'qng',
    'postprocess': 'qng',
    'mode': 'rev'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
adaptive_vmap Not yet run
unverified (harvested, no recorded run)
tensorcircuit/tensorcircuit-ng/tensorcircuit/experimental.py
code served (permissive licence) · get_code("5369768297703d55")
How it ran

no invocation recorded.

get_message Not yet run
unverified (harvested, no recorded run)
tensorcircuit/tensorcircuit-ng/tensorcircuit/asciiart.py
code served (permissive licence) · get_code("84d2719355b07177")
How it ran

no invocation recorded.

Also present in other papers' code

Of 5 samples lifted from this paper's linked repositories, 5 carry a function identity and 0 do not. Of the 5 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 5 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

TensorCircuit is an open source quantum circuit simulator based on tensor network contraction, designed for speed, flexibility and code efficiency. Written purely in Python, and built on top of industry-standard machine learning frameworks, TensorCircuit supports automatic differentiation, just-in-time compilation, vectorized parallelism and hardware acceleration. These features allow TensorCircuit to simulate larger and more complex quantum circuits than existing simulators, and are especially suited to variational algorithms based on parameterized quantum circuits. TensorCircuit enables orders of magnitude speedup for various quantum simulation tasks compared to other common quantum software, and can simulate up to 600 qubits with moderate circuit depth and low-dimensional connectivity. With its time and space efficiency, flexible and extensible architecture and compact, user-friendly API, TensorCircuit has been built to facilitate the design, simulation and analysis of quantum algorithms in the Noisy Intermediate-Scale Quantum (NISQ) era.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2205.10091")
get_code_for_paper("2205.10091")
have("2205.10091")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2205.10091.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2205.10091.svg)](https://syntology.ai/paper/2205.10091)

Connect an agent — have() is free.