Hi, I’m having trouble understanding the code of WGAN with gradient penalty here 58.
The code defines two tensors:

one = torch.FloatTensor([1])
mone = one * -1

Later, it defines the loss and takes gradient like this:

D_real = netD(real_data_v).mean()
D_real.backward(mone)

D_real is an autograd.Variable, and backward is a method associated to D_fake. What is the argument “mone” for?
Same for the argument “one” in:

D_fake = netD(inputv).mean()
D_fake.backward(one)

Does it have something to do with the labels for fake and real? Wouldn’t we just need to call .backward() with no arguments? This seems to be the standard source for WGAN-GP. I see a similar code in here 35, but I guess it was modified from the previous.