Skip to content

Inverting gates does not allow to save circuit in json #6538

Open
@nikita-astronaut

Description

@nikita-astronaut

Description of the issue

How to reproduce the issue


U = cirq.Circuit()
K = cirq.Circuit()
K.append(cirq.PhasedFSimGate(0, 0, 0, 0,0).on(cirq.GridQubit(0, 0), cirq.GridQubit(0, 1)))

U.append(K)
U.append(cirq.X.on(cirq.GridQubit(0, 0)))
U.append(cirq.inverse(K))


with open('test.json', 'wb') as f:
    f.write(cirq.to_json(U).encode('utf-8'))
    f.close()

U = cirq.read_json(open('test.json', 'rb'))

---> the following code will fail with:

ValueError: Could not resolve type '_InverseCompositeGate' during deserialization

Cirq version

1.2.0

Metadata

Metadata

Assignees

Labels

area/jsonarea/serializationkind/bug-reportSomething doesn't seem to work.triage/acceptedA consensus emerged that this bug report, feature request, or other action should be worked on

Type

No type

Projects

Status

No status

Relationships

None yet

Development

No branches or pull requests

Issue actions