How does autograd handle multiple objectives?
Using the pytorch framework. Suppose you have 4 NN modules of which 2 share weights such that one objective relies on the computation of 3 NN modules (including the 2 that share weights) and the other objective relies on the computation of 2 NN modules of which only 1 belongs to the weight sharing pair, the other module is not used for the first objective. What would the optimisation step in this scenario entail? With efficiency in mind.
Veril
In this case, you only have 3 NN modules, and one of them is simply reused. You give it the list of losses and grads. The optimization step is pretty standard, you give the all the modules’ parameters to a single optimizer.
smth
So just to be clear, specify a single objective that merges (concat) all the sub-objectives and backward() on it? There won’t be any issue regarding going over the same variables twice through different pathways? Thanks.
Veril
Yes. No issues.
smth