English
Languages
English
Bengali
French
Hindi
Japanese
Korean
Russian
Spanish
Tamil
Turkish



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 to True for a proper gradient computation when using TorchConnector.

Attributes

input_gradients

Returns whether gradients with respect to input data are computed by this neural network in the backward method or not.

num_inputs

Returns the number of input features.

num_weights

Returns the number of trainable weights.

operator

Returns the underlying operator of this QNN.

output_shape

Returns the output shape.

quantum_instance

Returns the quantum instance to evaluate the operator.

sparse

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.