def U_theta(theta, N): """ Quantum Neural Network """ # 按照量子比特数量/网络宽度初始化量子神经网络 cir = UAnsatz(N) # 调用内置的量子神经网络模板 cir.universal_2_qubit_gate(theta) # 返回量子神经网络所模拟的酉矩阵 U return cir.U
def U_theta(theta, N): """ Quantum Neural Network """ # Initialize the quantum neural network by the number of qubits (width of the network) cir = UAnsatz(N) # Use a built-in QNN template cir.universal_2_qubit_gate(theta, [0, 1]) # Return the Unitary matrix simulated by QNN return cir.U