Closed zhjwy9343 closed 2 years ago
Thank you for reporting this bug to us! Which pytorch version are you using currently?
Originally zero_gradients(x) is included in torch.autograd.gradcheck. While it has been removed. So I add the original source code for zero_gradients(x) into deepfool.py. See if it works now.
Do you still preserve the mistake? Try x.grad.zero_()
, I think it may work.
In the # 105 of deeprobust/image/attack/deepfool.py. The code was change from zero_gradients(x) to x.zero_grad(), which will cause the "AttributeError: 'Tensor' object has no attribute 'zero_grad'" error in Pytorch 1.10, 1.9, 1.8, 1.7.