Thank you for sharing.
I get a error: RuntimeError: Function AddBackward0 returned an invalid gradient at index 1 - expected type torch.FloatTensor but got torch.cuda.FloatTensor
In # Calculate gradientstotal_loss_g.backward()
We have made any changes.
Thank you for sharing. I get a error: RuntimeError: Function AddBackward0 returned an invalid gradient at index 1 - expected type torch.FloatTensor but got torch.cuda.FloatTensor In # Calculate gradientstotal_loss_g.backward() We have made any changes.