Does the calculation of Losses already change the Graph?

Hello there,
for evaluation purposes I ran 2 extra losses alongside the first main loss.
I only called backward on the main loss.
Do the other 2 loss calculations change anything for back propagation or any other update?

Greetings
Lemling

unless you call .backward() on the two extra losses, or add them to the main loss before calling backward (for eg. `(main_loss + loss_extra1 + loss_extra2).backward()), they wont affect the gradients you computed.

1 Like