Hello,
What is the best way in order to gather the parameters of a neural network (given as an nn.Module
object) into a single tensor (vector) and vice-versa?
The simplest option seems to be looping over the self.parameters()
, but I am not sure how efficient it is especially when we want to reconstruct the model from a tensor.