Comments (3)
Hi Caitao,
Yes, the IBM quantum machine doesn't provide the noise modeling for u3 and cu3 gates, they only have noise models for their native gates, which are 'id', 'sx', 'x', 'cx', 'reset', 'measure'. If you would like to add noise to u3 and cu3 gates, I suggest to transpile them to native gates then add noise to them.
from torchquantum.
Hi Hanrui,
I see. I have a question about an expected thing happening.
I ran the quantumnat.py and did some profiling (adding self.counter_x, self.counter_y, self.counter_z) in the NoiseModelTQ.sample_noise_op() function and observed a strange thing: only see PauliZ error is occurring. I am expecting that PauliX, PauliY, and PauliZ are all happening somewhat evenly, but only the PauliZ is happening. Is it normal, or did I do something wrong?
ops = []
for instruction in instructions:
v_wires = [
self.p_v_reg_mapping["p2v"][qubit] for qubit in instruction["qubits"]
]
if instruction["name"] == "x":
op = tq.PauliX(wires=v_wires)
self.counter_x += 1
print(f'{op_name} # x = {self.counter_x} ') <--print when PauliX error happens
elif instruction["name"] == "y":
op = tq.PauliY(wires=v_wires)
self.counter_y += 1
print(f'{op_name} # y = {self.counter_y} ') <--print when PauliY error happens
elif instruction["name"] == "z":
op = tq.PauliZ(wires=v_wires)
self.counter_z += 1
print(f'{op_name} # z = {self.counter_z} ') <--print when PauliZ error happens
elif instruction["name"] == "reset":
op = tq.Reset(wires=v_wires)
else:
# ignore operations specified by self.ignored_ops
logger.warning(f"skip noise operation {instruction['name']}")
continue
ops.append(op)
return ops
Also, I need to increase the factor to 100 (factor is a parameter to construct a NoiseModelTQ object) to observe some obvious noise. So it seems that the effect of noise is minimal when using factor=1, or is the example model in quantumnat.py too small (only 57 gates before transpile), so not affected by the noise a lot? I am curious during your experiments, do you need to increase the factor parameter?
Thanks for your time!
Caitao
from torchquantum.
Hi Caitao,
I have merged the PR. I think for single qubit operations, the probability for x y z are not the same. we can see the third entry [{'name': 'id', 'qubits': [0]}, {'name': 'z', 'qubits': [0]}] has pretty large probability compared with others. The second large is the y error. x error is pretty small.
for the 'sx' operation below
we have:
{'type': 'qerror', 'id': '3b46c51e30804c209684bb7925e81dab', 'operations': ['sx'], 'instructions':
[[{'name': 'id', 'qubits': [0]}, {'name': 'id', 'qubits': [0]}],
[{'name': 'id', 'qubits': [0]}, {'name': 'z', 'qubits': [0]}],
[{'name': 'id', 'qubits': [0]}, {'name': 'reset', 'qubits': [0]}],
[{'name': 'x', 'qubits': [0]}, {'name': 'id', 'qubits': [0]}],
[{'name': 'x', 'qubits': [0]}, {'name': 'z', 'qubits': [0]}],
[{'name': 'x', 'qubits': [0]}, {'name': 'reset', 'qubits': [0]}],
[{'name': 'y', 'qubits': [0]}, {'name': 'id', 'qubits': [0]}],
[{'name': 'y', 'qubits': [0]}, {'name': 'z', 'qubits': [0]}],
[{'name': 'y', 'qubits': [0]}, {'name': 'reset', 'qubits': [0]}],
[{'name': 'z', 'qubits': [0]}, {'name': 'id', 'qubits': [0]}],
[{'name': 'z', 'qubits': [0]}, {'name': 'z', 'qubits': [0]}],
[{'name': 'z', 'qubits': [0]}, {'name': 'reset', 'qubits': [0]}]],
'probabilities': [
0.9993659966232363,
3.579606708404507e-05,
0.0003028957754461616,
9.840382835998485e-05,
3.5247047159929088e-09,
2.9825013056958735e-08,
9.840382835998485e-05,
3.5247047159929088e-09,
2.9825013056958735e-08,
9.840382835998485e-05,
3.5247047159929088e-09,
2.9825013056958735e-08],
'gate_qubits': [(1,)]}
for your PR, the number of pauliX and pauliY is increase, i guess that is mainly because the twoqubit paulis?
from torchquantum.
Related Issues (20)
- But in example mnist_clifford_qnn.py HOT 2
- NameError: name 'Op2QAllLayer' is not defined HOT 2
- cannot install torchquantum
- Run example of QuantumNAS with error "no nodule namsed 'torchquantum.super_layers'" HOT 3
- running the example HOT 6
- Missing "qiskit.providers.backend"... very strange ! HOT 4
- Maybe there's a bug in 'apply_unitary_density_bmm' function? HOT 3
- Compatibility tq2qiskit function with ibm runtime job's paradigm for real deployment
- torch.save does not directly work with unexpected key(s)
- Enhance the Pulse-Level Simulation HOT 4
- Develop the TorchQuantum Testing Suite HOT 3
- Make TQ Compatible with Qiskit β₯1.0.0 HOT 3
- Supporting Additional Features for tq2qiskit and qiskit2tq HOT 3
- Adding new examples and algorithms for TQ HOT 4
- Will it be possible to run torchquantum code on quantum computer, when itβs built? HOT 5
- When I went to run examples/quantum_transformer/Qtransformer-torch.ipynb, an error occurred HOT 1
- how to add noise
- size error HOT 3
- Fail to install pyscf on Windows11
- How to perform backprop on a quantum circuit
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from torchquantum.