GithubHelp home page GithubHelp logo

mone in generator about improved-wgan-pytorch HOT 4 CLOSED

jalola avatar jalola commented on June 18, 2024 1
mone in generator

from improved-wgan-pytorch.

Comments (4)

jalola avatar jalola commented on June 18, 2024

Hi,

The last gen_cost = -gen_cost does not affect the gradients or the optimizer_g.step() because after backward(), gradients are calculated. It only affects the graph when we draw the gen_cost (It just flips vertically when you're putting - or not putting -)

What matters here is:
gen_cost.backward(mone) and
disc_cost = disc_fake - disc_real + gradient_penalty
disc_cost.backward()

After optimizer.step(), G tries to maximize gen_cost and D tries to minimize disc_fake(kind of gen_cost). So there is a fight between G and D.

from improved-wgan-pytorch.

udion avatar udion commented on June 18, 2024

yes thank you.
Tell me though are these 2 equivalent:

  • gen_cost = -gen_cost and then gen_cost.backward()
  • no need to invert gen_cost before calling backward and instead pass mone in backward (i.e what you did)

from improved-wgan-pytorch.

jalola avatar jalola commented on June 18, 2024

thanks too,

That's true

gen_cost = -gen_cost
gen_cost.backward()

would result the same.

from improved-wgan-pytorch.

Nikasa1889 avatar Nikasa1889 commented on June 18, 2024

The issue is solved.

from improved-wgan-pytorch.

Related Issues (20)

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.