Skip to content

Commit

Permalink
update for pr 8763
Browse files Browse the repository at this point in the history
  • Loading branch information
ewinston committed Sep 28, 2022
1 parent 3009590 commit bcf30ef
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
9 changes: 1 addition & 8 deletions qiskit/dagcircuit/dagcircuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -1688,14 +1688,7 @@ def count_ops(self, expand_control_flow=False):
Returns a dictionary of counts keyed on the operation name.
"""
op_count = self._op_names.copy()
if expand_control_flow:
for cfop in self.op_nodes(op=ControlFlowOp):
if cfop.name in op_count:
del op_count[cfop.name]
for block in cfop.op.blocks:
op_count = Counter(op_count) + Counter(block.count_ops())
return op_count
return self._op_names.copy()

def count_ops_longest_path(self):
"""Count the occurrences of operation names on the longest path.
Expand Down
2 changes: 1 addition & 1 deletion qiskit/transpiler/passes/layout/dense_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def run(self, dag):
num_meas = 1
else:
# Get avg number of cx and meas per qubit
ops = dag.count_ops(expand_control_flow=True)
ops = dag.count_ops(recurse=True)
if "cx" in ops.keys():
num_cx = ops["cx"]
if "measure" in ops.keys():
Expand Down

0 comments on commit bcf30ef

Please sign in to comment.