cg563 / simple-blackbox-attack

Code for ICML 2019 paper "Simple Black-box Adversarial Attacks"
MIT License
191 stars 56 forks source link

Problem on updating succs in simba_batch #26

Closed ChengChen2020 closed 1 year ago

ChengChen2020 commented 1 year ago

Hello,

I am trying to plot the average success rate against average query. When calculating success rate, I use

res = torch.load('MY/PATH/FOR/SIMBA/RESULTS') y = [res['succs'][:, i].sum() for i in range(res['succs'].shape[1])]

It turns out y list is not monotonically increasing. It might be due to the updating of succs array in simba_batch as follows

image

For example, suppose we have k = 100, then when entering line 113, succs[:, 99] would be updated. In the next iteration when k = 101, if remaining.sum() == 0, succs[:, 101:] is updated, while leaving succs[:, 100] not updated.

I am wondering if there's any specific reason why only the first k - 1 elements is updated in the kth iteration.

Thanks.

cg563 commented 1 year ago

This seems like a bug to me, thanks for catching it! I will fix the bug by changing L113 to succs[:, k].