loss_D.backward() wont accumulate any gradients for the generator parameters.
This is because of this line:
pred_fake = discriminator(fake_B.detach(), real_A)

The detach method prevents any gradient accumulation as it simply returns values.