If you want to use 2 losses on the same model, try this:
optimizer.zero_grad()
loss1 = torch.log(out1[0][0])*-10
loss2 = torch.log(out2[0][0])*-10
loss1.backward(retain_graph=True)
loss2.backward() 
optimizer.step()

also, in the example you have there is :
nn.Linear(32,out_feats)  ___ ]), <------  probably a typo
nn.Softmax(dim=1)___ ])     <------  cause it should include also the last layer