pytorch Official website torch.nn.parameter Is described as follows .
torch.nn.parameter Is a parameter used as a neural network module tensor. This is a kind of tensor Subclasses of .
parameters It's a subclass of tensor , When and module s When used together , They have a very special property —— When they are reassigned as module properties , They are automatically added to its parameter list , And it will appear in Parameters() In an iterator . Assigning a tensor has no such effect . This is because you may want to cache some temporary state in the model , such as RNN The last hidden state of . without Parameter Such a class , These temporary personnel will also be registered .