Hi,

I think the set_param function here is mainly built to be able to handle nested names. For example if your module is sequential that contains a conv. Then the name will be 0.weight. But you cannot use python’s setattr on that, you need to do first access “0” then “weight”.
I don’t think you can get around some kind of logic like that. The main reason being that you don’t want to override the original Parameters. Because you need to be able to backpropagate all the way back to them to update them. And so the intermediary Tensors can’t just be these Parameters modified inplace.

Hope this helps.