diff --git a/qiskit/aqua/components/optimizers/aqgd.py b/qiskit/aqua/components/optimizers/aqgd.py index 57c0d82a6e3b..dfd86030735e 100644 --- a/qiskit/aqua/components/optimizers/aqgd.py +++ b/qiskit/aqua/components/optimizers/aqgd.py @@ -129,7 +129,7 @@ def converged(self, objval, n=2): Returns: bool: Whether or not the optimization has converged. """ - if not hasattr(self, '_previous_loss'): + if self._previous_loss is None: self._previous_loss = [objval + 2 * self._tol] * n if all([absolute(objval - prev) < self._tol for prev in self._previous_loss]):