Thanks for the reply, this is one way to do it, but it will result in linear growth in memory according to the batch size, e.g. batch size of 128 will result in 128 different layers/modules stored. In the meantime, I’ll think of a more general approach that doesn’t require the replication of weights.