OpflowQNN¶
- class OpflowQNN(operator, input_params=None, weight_params=None, exp_val=None, gradient=None, quantum_instance=None, input_gradients=False)[source]¶
Bases:
qiskit_machine_learning.neural_networks.neural_network.NeuralNetwork
Opflow Quantum Neural Network.
- Parameters
operator (
OperatorBase
) – The parametrized operator that represents the neural network.input_params (
Optional
[List
[Parameter
]]) – The operator parameters that correspond to the input of the network.weight_params (
Optional
[List
[Parameter
]]) – The operator parameters that correspond to the trainable weights.exp_val (
Optional
[ExpectationBase
]) – The Expected Value converter to be used for the operator.gradient (
Optional
[Gradient
]) – The Gradient converter to be used for the operator’s backward pass.quantum_instance (
Union
[QuantumInstance
,BaseBackend
,Backend
,None
]) – The quantum instance to evaluate the network.input_gradients (
bool
) – Determines whether to compute gradients with respect to input data. Note that this parameter isFalse
by default, and must be explicitly set toTrue
for a proper gradient computation when usingTorchConnector
.
Attributes
Returns whether gradients with respect to input data are computed by this neural network in the
backward
method or not.Returns the underlying operator of this QNN.
Returns the quantum instance to evaluate the operator.
Methods