Skip to content

SimulatedLocalProcessor .run() vs .get_sampler().run() #5360

@mpharrigan

Description

@mpharrigan
proc = cg.engine.SimulatedLocalProcessor(
    processor_id='hey ma',
    sampler=cirq.Simulator(),
    device=cirq.UNCONSTRAINED_DEVICE,
)
samp = proc.get_sampler()
circ = cirq.Circuit(cirq.measure(cirq.LineQubit(0)))

print(repr(proc.run(circ)))
print(repr(samp.run(circ)))
cirq_google.EngineResult(params=cirq.ParamResolver({}), records={'0': np.array([[[0]]], dtype=np.int8)}, job_id='projects/fake_project/processors/hey ma/job/2', job_finished_time=datetime.datetime(2022, 5, 13, 0, 40, 23, 917546, tzinfo=datetime.timezone.utc))
cirq.ResultDict(params=cirq.ParamResolver({}), records={'0': np.array([[[0]]], dtype=np.int8)})

The processor knows about jobs and such and returns the new (#5152) EngineResult result subtype. If you just get sampler, it doesn't. cc @dstrain115

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions