cihangxie / DI-2-FGSM

Improving Transferability of Adversarial Examples with Input Diversity
MIT License
161 stars 38 forks source link

Does this code use momentum? #2

Closed christiancosgrove closed 6 years ago

christiancosgrove commented 6 years ago

In https://github.com/cihangxie/DI-2-FGSM/blob/dfa64f2842561518f99515ea9572b42f9bee0c62/attack.py#L179

the variable grad is initialized to zero. Presumably, grad stores the accumulated gradient for momentum updates. However, it seems that grad is not updated anywhere else in the code. Am I missing something?

Thanks!

cihangxie commented 6 years ago

There is a flag for momentum

tf.flags.DEFINE_float( 'momentum', 0.0, 'Momentum.')