DSE-MSU / DeepRobust

A pytorch adversarial library for attack and defense methods on images and graphs
MIT License
994 stars 192 forks source link

AttributeError: 'int' object has no attribute 'size' #103

Open Wud1 opened 2 years ago

Wud1 commented 2 years ago

run ./deeprobust/BPDA.py.

Traceback (most recent call last): File "/Users/chenxinliang/Desktop/DeepRobust-master/deeprobust/image/attack/BPDA.py", line 109, in BPDA_attack(img_t, 924, resnet18) File "/Users/chenxinliang/Desktop/DeepRobust-master/deeprobust/image/attack/BPDA.py", line 82, in BPDA_attack loss = l2(0,adv_def) File "/Users/chenxinliang/Anaconda3/anaconda3/python.app/Contents/lib/python3.6/site-packages/torch/nn/modules/module.py", line 547, in call result = self.forward(*input, **kwargs) File "/Users/chenxinliang/Anaconda3/anaconda3/python.app/Contents/lib/python3.6/site-packages/torch/nn/modules/loss.py", line 431, in forward return F.mse_loss(input, target, reduction=self.reduction) File "/Users/chenxinliang/Anaconda3/anaconda3/python.app/Contents/lib/python3.6/site-packages/torch/nn/functional.py", line 2177, in mse_loss if not (target.size() == input.size()): AttributeError: 'int' object has no attribute 'size'