From 315913fd5c1d493d618c54dc27c64af1f5f34726 Mon Sep 17 00:00:00 2001 From: Harry Kim <24K.Harry@gmail.com> Date: Tue, 5 Apr 2022 10:15:42 +0900 Subject: [PATCH] v3.2.6 --- UPDATE_HISTORY.md | 9 +++++++++ torchattacks/__init__.py | 2 +- torchattacks/attacks/_differential_evolution.py | 13 ++++++++++++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/UPDATE_HISTORY.md b/UPDATE_HISTORY.md index ccb63c0e..afa02360 100644 --- a/UPDATE_HISTORY.md +++ b/UPDATE_HISTORY.md @@ -419,3 +419,12 @@ * `save`: Now saving images and labels for every batch. * `OnePixel`: Now supports targeted version. * `_get_target_label`: Now generates target label under evaluation mode and `torch.no_grad()`. + + + + + + +### v3.2.6 + + * `_differential_evolution`: [bug fixed](https://github.com/Harry24k/adversarial-attacks-pytorch/issues/61). \ No newline at end of file diff --git a/torchattacks/__init__.py b/torchattacks/__init__.py index 929605cb..48a82e93 100644 --- a/torchattacks/__init__.py +++ b/torchattacks/__init__.py @@ -25,4 +25,4 @@ from .attacks.jitter import Jitter from .attacks.pixle import Pixle -__version__ = '3.2.5' +__version__ = '3.2.6' diff --git a/torchattacks/attacks/_differential_evolution.py b/torchattacks/attacks/_differential_evolution.py index 1884dab7..4528e18b 100644 --- a/torchattacks/attacks/_differential_evolution.py +++ b/torchattacks/attacks/_differential_evolution.py @@ -11,12 +11,23 @@ from __future__ import division, print_function, absolute_import import numpy as np from scipy.optimize import OptimizeResult, minimize -from scipy.optimize.optimize import _status_message +# from scipy.optimize.optimize import _status_message % for version < 1.8 +# from scipy.optimize.optimize_ import _status_message % for version >= 1.8 from scipy._lib._util import check_random_state from six import string_types __all__ = ['differential_evolution'] +_status_message = {'success': 'Optimization terminated successfully.', + 'maxfev': 'Maximum number of function evaluations has ' + 'been exceeded.', + 'maxiter': 'Maximum number of iterations has been ' + 'exceeded.', + 'pr_loss': 'Desired error not necessarily achieved due ' + 'to precision loss.', + 'nan': 'NaN result encountered.', + 'out_of_bounds': 'The result is outside of the provided ' + 'bounds.'} _MACHEPS = np.finfo(np.float64).eps