-
Notifications
You must be signed in to change notification settings - Fork 1.1k
'SingleQubitCliffordGate' object has no attribute '__name__' #6292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@epelaaez Do you want to work on this? |
Yes, I can look into it It seems like the problem here is that when defining a gate as follows: gate = cirq.SingleQubitCliffordGate.from_xz_map((cirq.X, False), (cirq.Z, False)) Doing |
Yep |
I found that doing ops_added = {
cliff(qubits[0]): cirq.asymmetric_depolarize(error_probabilities=pauli_error_rates)(qubits[0])
} solves the problem. The issue is that try:
return type_obj.__name__
except AttributeError:
return type_obj.__class__.__name__ but then I get {
"cirq_type": "InsertionNoiseModel",
"ops_added": [
[
{
"cirq_type": "OpIdentifier",
"gate_type": "SingleQubitCliffordGate",
"qubits": [
{
"cirq_type": "LineQubit",
"x": 0
}
]
},
{
"cirq_type": "GateOperation",
"gate": {
"cirq_type": "AsymmetricDepolarizingChannel",
"error_probabilities": {
"X": 0.1,
"Y": 0.1,
"Z": 0.1,
"I": 0.7
}
},
"qubits": [
{
"cirq_type": "LineQubit",
"x": 0
}
]
}
]
],
"prepend": true,
"require_physical_tag": false
} which loses information about the specific Clifford gate I'm using in my model. I think this is the intended behavior of |
So, it looks like |
Yes, I think that's the issue. At least that the specificity of certain inputs is lost when serializing it. |
Okay, sounds like a bug that we can fix as part of this. |
Uh oh!
There was an error while loading. Please reload this page.
Description of the issue
I'm trying to define a noise model with Clifford gates, and then serialize it. However, I get an error when trying to serialize it using
cirq.to_json
.How to reproduce the issue
A simplified version of my noise model is the following.
Then, I do the following to serialize it.
And I get the following.
(full log below)
I also noticed the same happens when I use a
cirq.CZ
gate.Cirq version
1.3.0.dev20230915001934
The text was updated successfully, but these errors were encountered: