This is what I did for the computation, just in case you want to check it out.
I still tried training the CycleGAN and it works, which doesn’t surprise me as I’m expecting the loss is just slightly off from what it’s supposed to be.
That is indeed incredibly close (0.000004% error), but the inputs are not random, so the output should be exact.
I believe your total loss line is correct, but did you check the other losses? You might have mixed up the order on the get_loss functions’ inputs and/or outputs. Please compare their definitions and the way you are using them.
If it helps, here is what you should expect for the “intermediate” losses:
Everything works now, even though I didn’t change the code.
I had a device issue with get_gen_adversarial_loss because of the device being passed.
In the end, I had a float-like tensor with a cuda device.
I recasted everything into integers and now the full sum works.
My assumption is there has been a mix up when casting types.
Thank you @pedrorohde for the numbers so I could debug it.
Final edit (hopefully): the INT conversion only works to pass the unit test, it will mess up when actually training cycle GAN.