Bengali
ভাষাসমূহ
English
Bengali
French
Hindi
Italian
Japanese
Korean
Malayalam
Russian
Spanish
Tamil
Turkish
Vietnamese
Shortcuts



TwoLayerQNN

class TwoLayerQNN(num_qubits=None, feature_map=None, ansatz=None, observable=None, exp_val=None, quantum_instance=None, input_gradients=False)[source]

Bases: qiskit_machine_learning.neural_networks.opflow_qnn.OpflowQNN

Two Layer Quantum Neural Network consisting of a feature map, a ansatz, and an observable.

প্যারামিটার
  • num_qubits (Optional[int]) -- The number of qubits to represent the network, if None and neither the feature_map not the ansatz are given, raise exception.

  • feature_map (Optional[QuantumCircuit]) -- The (parametrized) circuit to be used as feature map. If None is given, the ZZFeatureMap is used.

  • ansatz (Optional[QuantumCircuit]) -- The (parametrized) circuit to be used as ansatz. If None is given, the RealAmplitudes circuit is used.

  • observable (Optional[OperatorBase]) -- observable to be measured to determine the output of the network. If None is given, the Z^{otimes num_qubits} observable is used.

  • 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.

রেইজেস

QiskitMachineLearningError -- In case of inconsistent num_qubits, feature_map, ansatz.

Attributes

ansatz

Returns the used ansatz.

circuit

Returns the underlying quantum circuit.

feature_map

Returns the used feature map.

num_qubits

Returns the number of qubits used by ansatz and feature map.

Methods