ValueError: operands could not be broadcast together with shapes (3,224,224) (3,)
tzaiyang opened this issue · comments
当我用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,)
也就是出现除法维度不一致的情况。
然后我对照论文中的算法,发现算法中也是这样的
(6)式中的速度项维度就应该是(3,224,224)/(3,)呀(矩阵1范数是列和最大值),这样本来就不能实现相除,是我哪里理解错了吗?