mk100000:

What’s wrong with reassigning them new values? Isn’t it stored as the same object internally?


Initially params2 holds the reference of  torch.rand(2,1,requires_grad=True). When you assign again, it holds the reference of some intermediate value that’s computed by model. So, the answer is No. params2 is not holding the same object.
Also, your usage of params2 tells me that it is just an intermediate variable and not something that you want to optimize.
Maybe you have to elaborate a bit more on what is your end goal with context.



 mk100000:

I want param, param2, and param3 to undergo a nested set of computations; they should pick up on the computations they undergo relative to where they’re placed.


Like you said, they “will” pick-up on the computations and pass on the gradients to previous computations. That is definitely handled by pytorch. But you cannot optimize params2, as it is an intermediate value calculated by model (i.e., it will change for different inputs).
With the current code example and definitions of params*, it is not understandable what is expected from pytorch (at least not understandable to me).