setattr just adds an attribute to a python class, and that’s all: you can use getattr to get this attribute. But it is not sufficient to be an attribute of a pytorch model to be a parameter of this model, no.
To be a parameter of a pytorch model, it is necessary to be an instance of the class torch.nn.parameter.Parameter 5 and to be in the dictionary (OrderedDict 1)  _parameters of this model (which is one of its attributes). This is what register_parameter(name: str, param: Optional[Parameter]) does : self._parameters[name] = param (after several checks) : see the source code 19