Giter Site home page Giter Site logo

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

Kitzzaaa avatar Kitzzaaa commented on July 21, 2024
在这个路径下/sign_hunter_attack/attack.py ,attack.py中345行,显然调用了两次self.loss_fct,即查询了两次model,为啥query_count只加了一次?

from simulatorattack.

Comments (1)

machanic avatar machanic commented on July 21, 2024
  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. 如果我的理解有误,请告诉我。

from simulatorattack.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.