Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在这个路径下/sign_hunter_attack/attack.py ,attack.py中345行,显然调用了两次self.loss_fct,即查询了两次model,为啥query_count只加了一次? #7

Open
Kitzzaaa opened this issue Mar 7, 2022 · 1 comment

Comments

@Kitzzaaa
Copy link

Kitzzaaa commented Mar 7, 2022

No description provided.

@machanic
Copy link
Owner

machanic commented Mar 31, 2022

  1. 因为第234行https://github.com/machanic/SimulatorAttack/blob/master/sign_hunter_attack/attack.py#L334 对于bxs_t 已经查询过一次。所以不必重复查询self.loss_fct(model, bxs_t, label, target))。(虽然代码中重复查询了一次,但是因为前面已经查询过了,所以统计查询次数的时候query_count不用增加1次)
  2. 而且bxs_t = self.xo_t,所以只有当self.xo_t被更新时(即self.exhausted=True)需要增加查询次数,这一点在348行https://github.com/machanic/SimulatorAttack/blob/master/sign_hunter_attack/attack.py#L348增加了。
  3. 注意在https://github.com/machanic/SimulatorAttack/blob/master/sign_hunter_attack/attack.py#L364处,
    self.xo_t = xs_t.clone(),而xs_t每次传入def _suggest函数时都不同。
  4. 如果我的理解有误,请告诉我。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants