Skip to content

convert estimate_resources() output to json object #3645

@marwafar

Description

@marwafar
import cudaq
import re
import json

@cudaq.kernel
def mykernel():
    q = cudaq.qubit()

    rx(.0, q)
    ry(.0, q)
    rz(.0, q)
    h(q)
    x(q)
    y(q)
    z(q)
    s(q)
    t(q)

counts = cudaq.estimate_resources(mykernel)

for gate, val in counts.items():
      print (gate, val)

gives this error:
AttributeError: 'cudaq.mlir._mlir_libs._quakeDialects.cudaq_runtime.Resources' object has no attribute 'items'

It would be good to get this as json object

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions