Closed marijascekic closed 2 years ago
Please use MindSpore1.4.0 or below.
Thank you for your replay. When I use version 1.4.0. or 1.3.0 also I get an error message "Not registered CPU kernel: op[Evolution]! ". Using the following versions 1.1.0 ,1.1.1, 1.2.0rc1, 1.2.0, 1.2.1 I got a similar error message "SetKernelInfo] Operator[Evolution] is not support". For the version 1.0.1 and below I got error message "AttributeError: type object 'Validator' has no attribute 'check_tensors_dtypes_same_and_valid'".
I really suggest to use the new developed master version. In the old version, the simulator was implement in a mindspore cpu operator, so that use graph mode of mindspore. But now, we move the simulator cpp code in MindQuantum its own, and use pynative mode to build classical quantum neural network. For the new version of mindquantum, you can download it from following link based on your system.
You can find the new API in https://www.mindspore.cn/mindquantum/api/zh-CN/master/mindquantum.core.html Here is the code to implement your task in new version of mindquantum, please take a look.
from mindquantum import *
circuit = Circuit()
circuit += H.on(0)
circuit += Measure('q0').on(0)
print("Circuit:")
print(circuit)
sim = Simulator('projectq', 1)
res = sim.sampling(circuit, shots=100)
print("sampling result:")
print(res)
And the nice outputs are:
Circuit:
q0: ──H────M(q0)──
sampling result:
shots: 100
Keys: q0│0.00 0.14 0.28 0.42 0.56 0.7
────────┼───────────┴───────────┴───────────┴───────────┴───────────┴
0│▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
│
1│▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
│
{'0': 44, '1': 56}
After installing the master version, everything is fine and the output is nicer than in the older versions. Thank you very much!
I am trying to execute the next simple code:
from mindquantum.gate import X from mindquantum.circuit import Circuit from mindquantum.circuit import StateEvolution circuit = Circuit() circuit += X.on(0) StateEvolution(circuit).sampling(100)
I am using Windows 10 , mindspore 1.5.0, mindquantum 0.3.1 . Does anyone know how to fix the following error:
RuntimeError Traceback (most recent call last)