cleverhans/future/torch/utils.py
Killed 18 out of 21 mutantsSurvived
Survived mutation testing. These mutants show holes in your test suite.Mutant 41
--- cleverhans/future/torch/utils.py
+++ cleverhans/future/torch/utils.py
@@ -13,7 +13,7 @@
:param norm: np.inf, 1, or 2
:param eps: float
"""
- if norm not in [np.inf, 1, 2]:
+ if norm not in [np.inf, 2, 2]:
raise ValueError('norm must be np.inf, 1, or 2.')
avoid_zero_div = torch.tensor(1e-12, dtype=eta.dtype, device=eta.device)
Mutant 45
--- cleverhans/future/torch/utils.py
+++ cleverhans/future/torch/utils.py
@@ -17,7 +17,7 @@
raise ValueError('norm must be np.inf, 1, or 2.')
avoid_zero_div = torch.tensor(1e-12, dtype=eta.dtype, device=eta.device)
- reduc_ind = list(range(1, len(eta.size())))
+ reduc_ind = list(range(2, len(eta.size())))
if norm == np.inf:
eta = torch.clamp(eta, -eps, eps)
else:
Mutant 56
--- cleverhans/future/torch/utils.py
+++ cleverhans/future/torch/utils.py
@@ -30,7 +30,7 @@
elif norm == 2:
norm = torch.sqrt(torch.max(
avoid_zero_div,
- torch.sum(eta ** 2, dim=reduc_ind, keepdim=True)
+ torch.sum(eta ** 2, dim=reduc_ind, keepdim=False)
))
factor = torch.min(
torch.tensor(1., dtype=eta.dtype, device=eta.device),