- 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.
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.
bool) -- Returns whether the output is sparse or not.
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.
int, ...]]]]) -- 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.
None]) -- 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.
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.
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 quantum instance to evaluate the circuit.
Returns the list of trainable weights parameters.
Change 'interpret' and corresponding 'output_shape'.