Yes the create_graph is because you will backpropagate the computed gradients.
But what is the difference between these two optimizers? if “subnet” is part of “net”, you could do the same as long as the gradients for what is not part of subnet are 0? Which from my understanding they are?
If the only difference is that you want to use two different learning rates, you can fix that by scaling the gradients you backpropagate by doing for example new_loss.backward(torch.Tensor([2])).