If i have defined a traditional CNN network with builtin CrossENtropy function, then i can compute a loss and backward with the pytorch API : loss.backwar().

But i defined some new loss function based on the original loss, like this ** NewLoss = OriginalLoss + lambda*something**, how do i backward with this new loss function? Or anyone can provide a github project which train a neural network with self-defined loss function?

Thanks in advance for help