Setting and Accessing Attributes in PyTorch Models

  1. Is it possible to set attributes to model parameters by looping over model.named_children() and accessing them later by looping over ‘self.model.named_parameters()’? One example is below:
for key, val in self.model.named_children():
    val.classname = val.__class__.__name__

for key, val in self.model.named_parameters():
  1. More generally, what is a good read to understand how named_children(), named_modules(), named_parameters(), and state_dict() differ from each other and what are their application?