diff --git a/src/qibo/backends/numpy.py b/src/qibo/backends/numpy.py index eba0e8204a..7248b2348e 100644 --- a/src/qibo/backends/numpy.py +++ b/src/qibo/backends/numpy.py @@ -400,7 +400,11 @@ def execute_circuit(self, circuit, initial_state=None, nshots=1000): return self.execute_circuit(initial_state + circuit, None, nshots) elif initial_state is not None: initial_state = self.cast(initial_state) - valid_shape = 2 * (2**circuit.nqubits,) if circuit.density_matrix else (2**circuit.nqubits,) + valid_shape = ( + 2 * (2**circuit.nqubits,) + if circuit.density_matrix + else (2**circuit.nqubits,) + ) if tuple(initial_state.shape) != valid_shape: raise_error( ValueError,