DataBindingStage¶
- class DataBindingStage(data_params, loss_reduction, loss_constant=0.0, sample_loss=None)[source]¶
Bases:
BundleStageBind a classical feature batch into a parametric circuit.
expand()creates one variant per row ofenv.feature_batch, bindingdata_paramswhile leaving weight parameters symbolic. It uses QASM templates unless a downstream stage requires concrete DAG bodies.reduce()collapses the resulting data-sample axis withloss_reduction, optionally applying a supervisedsample_lossfirst.- Parameters:
data_params (
tuple[Parameter,...]) – Parameters corresponding to feature-batch columns.loss_reduction (
Callable[[ndarray[tuple[Any,...],dtype[double]]],float]) – Aggregation across per-sample results.loss_constant (
float) – Constant added before reduction.sample_loss (
Callable[[float,float],float] |None) – Optional supervised loss applied per prediction and label.
Attributes Summary
Axis name introduced by this stage.
Whether this stage sets up measurement circuits and result format.
Methods Summary
dry_expand(batch, env)Dry path: share the incoming parametric DAG across all sample variants.
expand(batch, env)Transform keyed MetaCircuit batch and return expansion lineage plus token.
introspect(batch, env, token)Return stage-specific metadata for dry-run reporting.
reduce(results, env, token)Identity by default; override if this stage reduces results.
validate(before, after)Use the template path unless a downstream stage consumes DAG bodies.
Attributes Documentation
- axis_name¶
- handles_measurement¶
Methods Documentation
- dry_expand(batch, env)[source]¶
Dry path: share the incoming parametric DAG across all sample variants. Per-sample data substitution is skipped — dry-run only needs correct circuit counts and depth/width stats, both of which are invariant under data binding.
- Return type:
StageOutput[dict[tuple[tuple[str,Hashable],...],MetaCircuit]]
- expand(batch, env)[source]¶
Transform keyed MetaCircuit batch and return expansion lineage plus token.
- Return type:
StageOutput[dict[tuple[tuple[str,Hashable],...],MetaCircuit]]
- introspect(batch, env, token)[source]¶
Return stage-specific metadata for dry-run reporting.
Override in subclasses to provide richer introspection data. Called by the dry-run tool after
expandwith the post-expand batch, the pipeline env, and the stage’s token.