Hi,
I tried to use Qiskit to visualize the circuit, but it was unsuccessful.(Pennylane=0.33.1)
import pennylane as qml
dev = qml.device("qiskit.aer", wires=4)
@qml.qnode(dev)
def circuit(params):
qml.RY(params[0], wires=0)
qml.RY(params[1], wires=1)
qml.CNOT(wires=[0, 1])
return qml.expval(qml.PauliZ(1))
params = [0.1, 0.3]
drawer = qml.draw(circuit, show_all_wires=True, wire_order=[2,1,0,3])
# print(drawer(params))
circuit(params)
dev._circuit.draw(output="mpl")
Error:
----> 34 circuit(params)
35 dev._circuit.draw(output="mpl")
File d:\Software\Anaconda3\anaconda3\envs\pennylane\lib\site-packages\pennylane\qnode.py:1027, in QNode.__call__(self, *args, **kwargs)
1022 full_transform_program._set_all_argnums(
1023 self, args, kwargs, argnums
1024 ) # pylint: disable=protected-access
1026 # pylint: disable=unexpected-keyword-arg
-> 1027 res = qml.execute(
1028 (self._tape,),
1029 device=self.device,
1030 gradient_fn=self.gradient_fn,
1031 interface=self.interface,
1032 transform_program=full_transform_program,
1033 config=config,
1034 gradient_kwargs=self.gradient_kwargs,
1035 override_shots=override_shots,
1036 **self.execute_kwargs,
1037 )
1039 res = res[0]
1041 # convert result to the interface in case the qfunc has no parameters
...
--> 502 if not pennylane.active_return():
503 res = self._statistics_legacy(circuit)
504 res = np.asarray(res)
AttributeError: module 'pennylane' has no attribute 'active_return'
How can I fix it to avoid mistakes?
I would appreciate it if you could give me some guidance.