Skip to content

Commit

Permalink
drop redundant validation
Browse files Browse the repository at this point in the history
  • Loading branch information
nkanazawa1989 committed Jul 2, 2021
1 parent ad48179 commit 291a1a5
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions qiskit/transpiler/passes/scheduling/instruction_alignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def run(self, dag: DAGCircuit):
DAGCircuit: DAG with consistent timing and op nodes annotated with duration.
Raises:
TranspilerError: When instruction duration is not provided.
TranspilerError: If circuit is not scheduled.
"""
time_unit = self.property_set["time_unit"]

Expand Down Expand Up @@ -88,7 +88,6 @@ def pad_with_delays(qubits: List[int], until, unit) -> None:
idle_duration = until - qubit_stop_times[q]
new_dag.apply_operation_back(Delay(idle_duration, unit), [q])

bit_indices = {bit: index for index, bit in enumerate(dag.qubits)}
for node in dag.topological_op_nodes():
start_time = max(qubit_time_available[q] for q in node.qargs)

Expand All @@ -100,20 +99,6 @@ def pad_with_delays(qubits: List[int], until, unit) -> None:
pad_with_delays(node.qargs, until=start_time, unit=time_unit)
new_dag.apply_operation_back(node.op, node.qargs, node.cargs)

# validate node.op.duration
if node.op.duration is None:
indices = [bit_indices[qarg] for qarg in node.qargs]
raise TranspilerError(
f"Duration of {node.op.name} on qubits " f"{indices} is not found."
)

if isinstance(node.op.duration, ParameterExpression):
indices = [bit_indices[qarg] for qarg in node.qargs]
raise TranspilerError(
f"Parameterized duration ({node.op.duration}) "
f"of {node.op.name} on qubits {indices} is not bounded."
)

stop_time = start_time + node.op.duration
# update time table
for q in node.qargs:
Expand Down

0 comments on commit 291a1a5

Please sign in to comment.