Sum the losses:
loss = loss1 + loss2
loss.backward()

Use the output of the sixth layer directly. Don’t put it in an nn.Sequential if that’s what you’re doing:
def forward(self, x):
  x = self.layer1(x)
  x = self.layer2(x)
  x = self.layer3(x)
  x = self.layer4(x)
  x = self.layer5(x)
  l6 = self.layer6(x)
  l7 = self.layer7(l6)
  loss1 = my_loss_fn(l7)
  loss2 = my_loss_fn(l6)
  return loss1 + loss2