I wonder, whether cloning a ParameterList can work.
In cloneable.h there is the sequence:
copy->parameters_.clear(); copy->buffers_.clear(); copy->children_.clear(); copy->reset(); TORCH_CHECK( copy->parameters_.size() == parameters_.size(), "The cloned module does not have the same number of " "parameters as the original module after calling reset(). " "Are you sure you called register_parameter() inside reset() " "and not the constructor?");
reset in parameterlist.h shows
///
reset()
is empty forParameterList
, since it does not have parameters
/// of its own.
void reset() override {}
To my understanding all the parameters, children, etc. are cleared first. Reset does nothing. Then the assertion fails. Or do I get this wrong?