- class CircuitQNN(circuit, input_params=None, weight_params=None, sparse=False, sampling=False, interpret=None, output_shape=None, gradient=None, quantum_instance=None, input_gradients=False)¶
Pending deprecation: A sampling neural network based on a given quantum circuit.
unknown ভার্সন থেকে ডেপ্রিকেটেড: The CircuitQNN class has been superseded by the qiskit_machine_learning.neural_networks.SamplerQNN This class will be deprecated in a future release and subsequently removed after that.
circuit (QuantumCircuit) -- The parametrized quantum circuit that generates the samples of this network. There will be an attempt to transpile this circuit and cache the transpiled circuit for subsequent usages by the network. If for some reasons the circuit can't be transpiled, e.g. it originates from
RawFeatureVector, the circuit will be transpiled every time it is required to be executed and only when all parameters are bound. This may impact overall performance on the network.
sparse (bool) -- Returns whether the output is sparse or not.
sampling (bool) -- Determines whether the network returns a batch of samples or (possibly sparse) array of probabilities in its forward pass. In case of probabilities, the backward pass returns the probability gradients, while it returns
(None, None)in the case of samples. Note that
sampling==Truewill always result in a dense return array independent of the other settings.
interpret (Callable[[int], int | Tuple[int, ...]] | None) -- A callable that maps the measured integer to another unsigned integer or tuple of unsigned integers. These are used as new indices for the (potentially sparse) output array. If this is used, and
sampling==False, the output shape of the output needs to be given as a separate argument. If no interpret function is passed, then an identity function will be used by this neural network.
output_shape (int | Tuple[int, ...]) -- The output shape of the custom interpretation, only used in the case where an interpret function is provided and
sampling==False. Note that in the remaining cases, the output shape is automatically inferred by:
sampling==Trueand an interpret function is provided.
gradient (Gradient) -- The gradient converter to be used for the probability gradients.
quantum_instance (Backend | QuantumInstance | None) -- The quantum instance to evaluate the circuits. Note that if
sampling==True, a statevector simulator is not a valid backend for the quantum instance.
input_gradients (bool) -- Determines whether to compute gradients with respect to input data. Note that this parameter is
Falseby default, and must be explicitly set to
Truefor a proper gradient computation when using
QiskitMachineLearningError -- if
interpretis passed without
Returns the underlying quantum circuit.
Returns whether gradients with respect to input data are computed by this neural network in the
backwardmethod or not.
Returns the list of input parameters.
Returns interpret function to be used by the neural network.
Returns the number of input features.
Returns the number of trainable weights.
Returns the output shape.
Returns the quantum instance to evaluate the circuit.
Trueif the network returns a batch of samples and
Falseif a sparse vector (dictionary) of probabilities in its forward pass.
Returns whether the output is sparse or not.
Returns the list of trainable weights parameters.
Backward pass of the network.
Forward pass of the network.
Histogram (as dict) of the samples from the network.
Probability gradients of histogram resulting from the network.
Samples from the network.
Change 'interpret' and corresponding 'output_shape'.