advboxes / AdvBox

Advbox is a toolbox to generate adversarial examples that fool neural networks in PaddlePaddle、PyTorch、Caffe2、MxNet、Keras、TensorFlow and Advbox can benchmark the robustness of machine learning models. Advbox give a command line tool to generate adversarial examples with Zero-Coding.
Apache License 2.0
1.39k stars 265 forks source link

ValueError: operands could not be broadcast together with shapes (3,224,224) (3,) #26

Closed tzaiyang closed 5 years ago

tzaiyang commented 5 years ago

当我用MIFGSM方法做攻击实验时,我发现出现了以下错误: File "attack.py", line 184, in main adversary = attack(adversary, **attack_config) File "/Users/anselt/IJCAI/9102/targeted/advbox/attacks/base.py", line 48, in __call__ return self._apply(adversary, **kwargs) File "/Users/anselt/IJCAI/9102/targeted/advbox/attacks/gradient_method.py", line 296, in _apply velocity = gradient / self._norm(gradient, ord=1) ValueError: operands could not be broadcast together with shapes (3,224,224) (3,) 也就是出现除法维度不一致的情况。 然后我对照论文中的算法,发现算法中也是这样的

Screen Shot 2019-05-16 at 11 20 30 AM

(6)式中的速度项维度就应该是(3,224,224)/(3,)呀(矩阵1范数是列和最大值),这样本来就不能实现相除,是我哪里理解错了吗?