I think your IMTL code have bug.
if follow your code : parameters = itertools.chain(model.parameters(), IMTL.parameters())
and run list(IMTL.parameters()) will get a empty list. Also, after optimizer.step(), the s_t will not update.

The problem comes from you not initial self.register_parameter('s_t',nn.Parameter(torch.ones(self.num_losses+1).squeeze(),requires_grad=True))
in the init() function, therefore optimizer will not update s_t
I have changed your code like this :

I think your IMTL code have bug.

if follow your code :
parameters = itertools.chain(model.parameters(), IMTL.parameters())and run
list(IMTL.parameters())will get a empty list. Also, afteroptimizer.step(), the s_t will not update.The problem comes from you not initial
self.register_parameter('s_t',nn.Parameter(torch.ones(self.num_losses+1).squeeze(),requires_grad=True))in the
init()function, thereforeoptimizerwill not update s_tI have changed your code like this :