Try:



 edshkim98:

            loss = main_loss(output_pred,labels)
            total_loss = loss + ls_fake
            total_loss.backward()



Like the error say, there might be a problem with you replacing the loss value.