PennyLaneSpecStage

class PennyLaneSpecStage[source]

Bases: CircuitSpecStage

SpecStage that converts PennyLane circuits into MetaCircuit(s).

Accepts QuantumScript or QNode objects (single, sequence, or mapping). QNodes are traced into a symbolic QuantumScript — the trainable arguments are seeded with sympy symbols — before conversion.

QNode parameter handling:

  • Scalar parameters (def circuit(x, y)) become sympy symbols.

  • Single 1-D array parameter (def circuit(params)), including PennyLane templates such as AngleEmbedding and IQPEmbedding, is auto-sized to the device wire count and traced symbolically.

  • Structured-shape or multiple array parameters (e.g. StronglyEntanglingLayers, or circuit(inputs, weights)) can’t be inferred here. Pass a QuantumScript with explicit sympy symbols, or use CustomVQA’s arg_shapes / data_arg to declare the shapes.

Supported measurements: probs(), expval(), and counts(). Other PennyLane measurement types (sample, state, var, etc.) are not supported by the pipeline execution backend.

Methods Summary

expand(batch, env)

Convert PennyLane circuit(s) to MetaCircuit(s) and build a keyed batch.

Methods Documentation

expand(batch, env)[source]

Convert PennyLane circuit(s) to MetaCircuit(s) and build a keyed batch.

Return type:

tuple[dict[tuple[tuple[str, Hashable], ...], MetaCircuit], Any]