sarathknv / adversarial-examples-pytorch

Implementation of Papers on Adversarial Examples
389 stars 79 forks source link

Something has gone wrong... #2

Open tuji-sjp opened 5 years ago

tuji-sjp commented 5 years ago

When I tried to run this code, the following error occurred:

Fast Gradient Sign Method Model: inception_v3

Traceback (most recent call last): File "fgsm.py", line 62, in out = model(inp) File "/home/jinping/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 477, in call result = self.forward(*input, **kwargs) File "/home/jinping/anaconda3/lib/python3.6/site-packages/torchvision/models/inception.py", line 117, in forward x = F.avg_pool2d(x, kernel_size=8) RuntimeError: Given input size: (2048x5x5). Calculated output size: (2048x0x0). Output size is too small at /home/jinping/project/pytorch/aten/src/THCUNN/generic/SpatialAveragePooling.cu:63

sarathknv commented 5 years ago

Image size should be 299x299 for Inception. After you make this change in the code, you'll encounter a different error.

Traceback (most recent call last): File "fgsm.py", line 77, in <module> loss.backward() File "/usr/local/lib/python3.5/dist-packages/torch/tensor.py", line 96, in backward torch.autograd.backward(self, gradient, retain_graph, create_graph) File "/usr/local/lib/python3.5/dist-packages/torch/autograd/__init__.py", line 90, in backward allow_unreachable=True) # allow_unreachable flag RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation

There's some problem with Inception model.

tuji-sjp commented 5 years ago

Image size should be 299x299 for Inception. After you make this change in the code, you'll encounter a different error.

Traceback (most recent call last): File "fgsm.py", line 77, in <module> loss.backward() File "/usr/local/lib/python3.5/dist-packages/torch/tensor.py", line 96, in backward torch.autograd.backward(self, gradient, retain_graph, create_graph) File "/usr/local/lib/python3.5/dist-packages/torch/autograd/__init__.py", line 90, in backward allow_unreachable=True) # allow_unreachable flag RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation

There's some problem with Inception model.

ok, I will check it.