Hi @josh,
Please help me with the solution for the following error in the code.
Thanks.
import pennylane as qml
from pennylane import numpy as np
x = random.randint(255, size=(4, 4))
param = x.reshape(16,).tolist()
dev = qml.device("default.qubit", wires=16)
@qml.qnode(dev)
def circuit(pix):
for i in range(16):
qml.RY(pix[i], wires=i)
return [qml.expval(qml.PauliZ(j)) for j in range(16)]
m = circuit(param)
print(type(m))
final = np.ndarray(m)
Output:
<class 'pennylane.numpy.tensor.tensor'>
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-11-c394eabe543f> in <module>()
17 m = circuit(param)
18 print(type(m))
---> 19 final = np.ndarray(m)
TypeError: only integer scalar arrays can be converted to a scalar index