named_buffers() and buffers() returns the same buffers where the first operation returns the corresponding name for each buffer. I’m explicitly using “buffer” to avoid conflicting it with parameters, which are different. Both are registered to the nn.Module where parameters are trainable while buffers are not.


Yes, the name of the buffer or parameter is determined by its variable name (e.g. self.my_param = nn.Parameter(...) would return “my_param” as the name) or explicitly via self.register_buffer(name, buffer) or self.register_parameter(name, param).