diff --git a/robustness/__init__.py b/robustness/__init__.py index 78f22b6..1e9c668 100644 --- a/robustness/__init__.py +++ b/robustness/__init__.py @@ -1,2 +1,2 @@ name = "robustness" -__version__ = "1.0.post1" +__version__ = "1.2.post1" diff --git a/robustness/attack_steps.py b/robustness/attack_steps.py index 61bd38a..f74b03d 100644 --- a/robustness/attack_steps.py +++ b/robustness/attack_steps.py @@ -122,7 +122,6 @@ def project(self, x): def step(self, x, g): """ """ - # Scale g so that each element of the batch is at least norm 1 l = len(x.shape) - 1 g_norm = ch.norm(g.view(g.shape[0], -1), dim=1).view(-1, *([1]*l)) scaled_g = g / (g_norm + 1e-10) diff --git a/robustness/datasets.py b/robustness/datasets.py index bab1b88..e67bebe 100644 --- a/robustness/datasets.py +++ b/robustness/datasets.py @@ -88,7 +88,8 @@ def override_args(self, default_args, new_args): if len(extra_args) > 0: raise ValueError(f"Invalid arguments: {extra_args}") for k in kwargs: req_type = type(default_args[k]) - if not isinstance(kwargs[k], req_type): + no_nones = (default_args[k] is not None) and (kwargs[k] is not None) + if no_nones and (not isinstance(kwargs[k], req_type)): raise ValueError(f"Argument {k} should have type {req_type}") return {**default_args, **kwargs} diff --git a/setup.py b/setup.py index 677f14c..04de9d0 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ # Versions should comply with PEP440. For a discussion on single-sourcing # the version across setup.py and the project code, see # https://packaging.python.org/en/latest/single_source_version.html - version='1.2', + version='1.2.post1', description='Tools for Robustness', long_description=long_description,