I didn't understand the backward part in WGAN

Could you help this part of the code
errD_real.backward(one)

there is no loss function. the D model is just returning the mean of the mini batch input. how the network is calculating the cost and computing the gradient?