mindquantum.nn.PQC

class mindquantum.nn.PQC(*args, **kwargs)[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.

  • 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