I am working on adversarial attacks in pytorch. I am performing iterative gradient sign based attacks, but as cudnn is not deterministic the input gradient sign may vary and over many iterations this accumulates and gives very different results. For detailed discussion look discussion - 1 2 and discussion - 2.
I looked at other pytorch implementations but they also follow similar procedure.
As answered in those links by @albanD (really appreciated!) I first tried setting torch.backends.cudnn.deterministic = True but it didn’t work out.
Then I also thought of giving cunn a try so I did torch.backends.cudnn.enabled=False but it also didn’t help and still it’s non reproducible and varying significantly.
As adversarial attacks don’t have any kind of training involved but only backpropogation (atleast iterative gradient sign methods!) I think for I need to ensure reproducibility of results consistently
Why didn’t changing those flags work out? how to get deterministic behaviour (I could find only these two methods on searching)
Thanks a lot in advanced!