In the Inception model, in addition to final softmax classifier, there are a few auxiliary classifiers to overcome the vanishing gradient problem.
My question is
How can I compute the loss with all the classifiers? Can anyone give me an example?
output, aux_output = models.inception_v3(input)
loss = criterion(output, aux_output, target_var)
loss.backward()
optimizer.step()

or
output, aux_output = models.inception_v3(input)
loss1 = criterion(output, target_var)
loss2 = criterion(aux_output, target_var)
loss = loss1 + loss2
loss.backward()
optimizer.step()