Solved by JuanFMontesinos in post #5 
              
              
                Assuming that you meant this: 
a=A(input)
output = B(a)

B_solver = optim.Adam(B.parameters(), lr=learning_rate_B)
B_loss = loss(output, target)
B_loss.backward()
B_solver.step()

A weights won’t be updated as the haven’t been passed to the optimizer. You can update them just by passing also A to th…