Giter VIP home page Giter VIP logo

Comments (6)

caogang avatar caogang commented on June 15, 2024 2

I use retain_graph=True in autograd.grad to support twice backward which is the same as retain_variable=True. And I want get the gradient w.r.t. input without accumulating into .grad, just get the gradient. So I use autograd.grad instead of backward(). https://github.com/caogang/wgan-gp/blob/master/gan_toy.py#L204-L207

from wgan-gp.

caogang avatar caogang commented on June 15, 2024

No, D_real is what we want to maximize, so we minimize the loss (-D_real)

from wgan-gp.

ypxie avatar ypxie commented on June 15, 2024

Thanks for your reply. That makes sense, but why does author of Wgan do the opposite in
https://github.com/martinarjovsky/WassersteinGAN/blob/master/main.py ?

from wgan-gp.

caogang avatar caogang commented on June 15, 2024

Maybe, the output of net_d is the loss or error in the implementation of wgan. It is up to the definition of net_d

from wgan-gp.

ypxie avatar ypxie commented on June 15, 2024

Hello, Thanks for the explaining. I have a question, since you backward through the network twice, why is retain_variable=True not used in the code? And why not directly use D_cost.backward() once ?

from wgan-gp.

eifuentes avatar eifuentes commented on June 15, 2024

@ypxie @caogang see the WGAN author's comment in this issue martinarjovsky/WassersteinGAN#9 the two approaches are equivalent as long as you are consistent.
image

from wgan-gp.

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.