mindquantum.nn.PQC
- class mindquantum.nn.PQC(n_qubits, encoder_params_names, ansatz_params_names, gate_names, gate_matrix, gate_obj_qubits, gate_ctrl_qubits, gate_params_names, gate_coeff, gate_requires_grad, hams_pauli_coeff, hams_pauli_word, hams_pauli_qubit, is_projector, projectors, n_threads)[source]
Evaluate a parameterized quantum circuit and calculate the gradient of each parameters.
Inputs of this operation is generated by MindQuantum framework.
- Inputs:
n_qubits (int) - The qubit number of quantum simulator.
encoder_params_names (list[str]) - The parameters names of encoder circuit.
ansatz_params_names (list[str]) - The parameters names of ansatz circuit.
gate_names (list[str]) - The name of each gate.
gate_matrix (list[list[list[list[float]]]]) - Real part and image part of the matrix of quantum gate.
gate_obj_qubits (list[list[int]]) - Object qubits of each gate.
gate_ctrl_qubits (list[list[int]]) - Control qubits of each gate.
gate_params_names (list[list[str]]) - Parameter names of each gate.
gate_coeff (list[list[float]]) - Coefficient of eqch parameter of each gate.
gate_requires_grad (list[list[bool]]) - Whether to calculate gradient of parameters of gates.
hams_pauli_coeff (list[list[float]]) - Coefficient of pauli words.
hams_pauli_word (list[list[list[str]]]) - Pauli words.
hams_pauli_qubit (list[list[list[int]]]) - The qubit that pauli matrix act on.
is_projector (bool) - Whether the measurement operator is a subspace bitstring measurement.
projectors (Union[str, list[str]]) - The projector bitstrings.
n_threads (int) - Thread to evaluate input data.
- Outputs:
expected_value (Tensor) - The expected value of hamiltonian.
g1 (Tensor) - Gradient of encode circuit parameters.
g2 (Tensor) - Gradient of ansatz circuit parameters.
- Supported Platforms:
CPU