Skip to content

Should we deprecate Circuit.device? #3295

@mpharrigan

Description

@mpharrigan

Currently, each and every cirq.Circuit has a device attribute which defaults to UnconstrainedDevice. I think the original idea was that validation of device constraints would happen during circuit construction.

  1. This strikes me as strange. It makes more sense to me to have a device validate a circuit.
  2. Separating validation from circuit construction would permit more useful validation functionality. For example: instead of erroring out at the first bad gate, you could return a list of all the problems found and/or suggestions on how to fix problems identified
  3. In my experience, no one uses cirq.Circuit.device. You could argue that this attribute is a good marker for how the circuit has been compiled (i.e. what it's targeted at) but the provided compilers / circuit transformers don't set this property on the resultant circuit.

xref #3244

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions