Assume that i have three separated classifiers connected to the same nodes (see the attached image). How will the .backward(), .step() impact the training in the following scenarios?
scenario 1:
loss_1.backward()
loss_1.step()
loss_2.backward()
loss_2.step()
loss_3.backward()
loss_3.step()
scenario 2:
loss_1.backward()
loss_2.backward()
loss_3.backward()
total_loss = loss_1 + loss_2 + loss_3
total_loss.step()
scenario 3:
total_loss = loss_1 + loss_2 + loss_3
total_loss.backward()
total_loss.step()
I’m wondering if I sum up the total loss from two separated classifiers, and backpropogate, will these separated classifiers only be influenced by their own part of the loss within the total_loss? Will pytorch automatically use each of these part within the total_loss, or just backpro based on the total_loss ?
Many thanks in advanced!