Jingwei

Results 4 comments of Jingwei

I found the same problem. My solution is to send the copy of the input (input.clone()) when calling the run function.

> I found the same problem. My solution is to send the copy of the input (input.clone()) when calling the run function. > 也许只是眼睛看起来不太明显,但是利用函数求原始图片以及对抗样本的distortion,还是能够看出区别,很明显针对两幅原图比较,结果为0,原始图片与对抗图片肯定不能为0。 其实很明显,你只要在optimizer里不停打印input_adv和input_var就能看出每次更新,input_var也会被更新。我还没细究原因,目前看,可能是直接用input_var的话, pytorch内部机制导致一些关于grad的地方没有真正被关掉。我尝试在使用input_var的地方先clone一份出来,然后发现,input就不变了。

> I found the same problem. My solution is to send the copy of the input (input.clone()) when calling the run function. > 也许只是眼睛看起来不太明显,但是利用函数求原始图片以及对抗样本的distortion,还是能够看出区别,很明显针对两幅原图比较,结果为0,原始图片与对抗图片肯定不能为0。 > > 其实很明显,你只要在optimizer里不停打印input_adv和input_var就能看出每次更新,input_var也会被更新。我还没细究原因,目前看,可能是直接用input_var的话, pytorch内部机制导致一些关于grad的地方没有真正被关掉。我尝试在使用input_var的地方先clone一份出来,然后发现,input就不变了。 > >...

> I found the same problem. My solution is to send the copy of the input (input.clone()) when calling the run function. > 也许只是眼睛看起来不太明显,但是利用函数求原始图片以及对抗样本的distortion,还是能够看出区别,很明显针对两幅原图比较,结果为0,原始图片与对抗图片肯定不能为0。 > 其实很明显,你只要在optimizer里不停打印input_adv和input_var就能看出每次更新,input_var也会被更新。我还没细究原因,目前看,可能是直接用input_var的话, pytorch内部机制导致一些关于grad的地方没有真正被关掉。我尝试在使用input_var的地方先clone一份出来,然后发现,input就不变了。 > input中的原始图片也会更新?? >...