OpflowQNN¶
- class OpflowQNN(operator, input_params=None, weight_params=None, exp_val=None, gradient=None, quantum_instance=None, input_gradients=False)[source]¶
Bases:
NeuralNetwork
Pending deprecation: Opflow Quantum Neural Network.
Deprecated since version unknown: The OpflowQNN class has been superseded by the qiskit_machine_learning.neural_networks.EstimatorQNN This class will be deprecated in a future release and subsequently removed after that.
- Parameters:
operator (OperatorBase) – The parametrized operator that represents the neural network.
input_params (List[Parameter] | None) – The operator parameters that correspond to the input of the network.
weight_params (List[Parameter] | None) – The operator parameters that correspond to the trainable weights.
exp_val (ExpectationBase | None) – The Expected Value converter to be used for the operator.
gradient (Gradient | None) – The Gradient converter to be used for the operator’s backward pass.
quantum_instance (Backend | QuantumInstance | 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 is
False
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 number of input features.
Returns the number of trainable weights.
Returns the underlying operator of this QNN.
Returns the output shape.
Returns the quantum instance to evaluate the operator.
Returns whether the output is sparse or not.
Methods
backward
(input_data, weights)Backward pass of the network.
forward
(input_data, weights)Forward pass of the network.