AGENT SKILL

operators-transforms

Use PennyLane operations, templates, observables, op math, decompositions, compile pipelines, transforms, and custom-operator validation.

License 许可
Apache-2.0
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
operators-transforms
license
Apache 2.0
metadata
{ "disco-role": "operating" }
description
Use PennyLane operations, templates, observables, op math, decompositions, compile pipelines, transforms, and custom-operator validation.
disable-model-invocation
true

02 资源文件 5

03 SKILL.md 正文

Operators, templates, and transforms

Use this sub-skill when a task asks which operation/template to use, how to compose observables, how to inspect operator matrices/eigenvalues, how to decompose or compile a circuit, or how to add/validate custom operators.

Read first

Route within this sub-skill

  • Basic gates and observables: use top-level gates like qp.RX, qp.RY, qp.RZ, qp.CNOT, qp.Hadamard, qp.PauliX/Y/Z, and measurement observables through circuits/devices.
  • Templates: use qp.AngleEmbedding, qp.AmplitudeEmbedding, qp.StronglyEntanglingLayers, state-preparation templates, subroutines, and tensor-network templates when a workflow needs reusable ansatz structure.
  • Operator arithmetic: use qp.sum, qp.prod, qp.s_prod, qp.pow, qp.adjoint, qp.ctrl, qp.cond, qp.exp, qp.dot, qp.commutator, and qp.pauli_decompose to compose or analyze operators.
  • Inspection: use qp.matrix, qp.eigvals, qp.generator, qp.is_unitary, qp.is_hermitian, qp.is_commuting, qp.equal, qp.assert_equal, qp.simplify, and qp.map_wires.
  • Transforms: use qp.transform for custom tape transforms; use packaged transforms such as qp.compile, qp.decompose, batching transforms, qp.defer_measurements, dynamic-one-shot, Clifford+T decomposition, and pattern matching.
  • Custom operators: route to the custom-operator workflow and validate with pennylane.ops.functions.assert_valid(op).

Boundaries

Minimal pattern

import pennylane as qp

op = 0.5 * qp.PauliZ(0) + qp.PauliX(1) @ qp.PauliZ(2)
print(qp.simplify(op))
print(qp.matrix(qp.RX(0.2, wires=0)))

@qp.qnode(qp.device("default.qubit", wires=3))
def circuit(x):
    qp.AngleEmbedding(x, wires=range(3), rotation="Y")
    qp.StronglyEntanglingLayers(qp.numpy.zeros((1, 3, 3)), wires=range(3))
    return qp.expval(op)

print(qp.draw(qp.compile(circuit))(qp.numpy.array([0.1, 0.2, 0.3])))

Verification cues

For a useful answer, include expected parameter shapes, wire conventions, transform level (user, device, or gradient) when drawing/compiling, and a validation step such as assert_valid, qp.matrix, qp.draw, or focused tests for source changes.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-triton-opt

Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-solve

END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-skill

PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-pattern-fusion

Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-orchestrate

Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-feedback

Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).

★ 351