Hi,
For definining custom losses, you just need to define forward function. Backward function is completely computed by Autograd engine.
g_loss = generator_criterion(fake_out, fake_img, real_img)


This line is equal to:
g_loss = generator_criterion.forward(fake_out, fake_img, real_img)

So, explicitly you call forward, and autograd engine will compute backward operation when you can backward in line:
g_loss.backward()

And also, a neural network woks in the way that first you feedforward, then backpropagate errors which in most of the libraries, backward operation has been handled by an automatic engine for computing gradients.
Bests