计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
qnn-gradients【效率与协作】Construct, execute, differentiate, and troubleshoot Qiskit Machine Learning neural networks and quantum geometry with EstimatorQNN, SamplerQNN, public V2 primitives, and layout-aware gradient workflows.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this route when a request is about NeuralNetwork, EstimatorQNN,
SamplerQNN, forward/backward, parameter-shift or other QNN gradients,
input gradients, observables, sampler interpretation, sparse outputs, QFI/QGT,
effective dimension, or transpilation/layout handling for these workflows.
scripts/qnn_smoke.py with --help for the
bundled public-API smoke; run it without arguments for a tiny
estimator/sampler forward and backward check.Route full classifier/regressor fitting, optimizers, callbacks, and persistence
to the algorithms route. Route fidelity kernels and state-fidelity circuits to
kernels-fidelity. Route TorchConnector, autograd, sparse Torch integration,
and hybrid PyTorch networks to data-circuits-connectors; this route only
supplies the QNN and gradient contract that the connector consumes.
python -m pip install qiskit-machine-learning; add sparse only for
sparse SamplerQNN output and use the optional dependency required by the
chosen external primitive/backend when applicable.EstimatorQNN) or
a probability/distribution (SamplerQNN). A QNN is stateless: it stores a
parameterized circuit and primitives, but not trainable weight values or a
fitting loop.input_params and weight_params sequences. The circuit must have
exactly the combined number of parameters.EstimatorQNN, use a circuit without measurements and supply one
observable or a sequence of observables. For SamplerQNN, ensure the circuit
is measured; custom interpret requires an explicit output_shape.meas or c.input_gradients=True only when input
derivatives are needed; the default backward pass returns weight gradients
and None for input gradients.gradient.run; run-time options override gradient defaults, which
override primitive defaults.Do not claim that a CPU reference smoke proves a vendor backend, cloud runtime, CUDA, or shot-noise behavior. Record an unavailable optional backend as unverified and preserve the recovery steps in troubleshooting.md.