Hi,
In this post I wrote a function that renames a name of module without changing the order of it. You can use it in reverse mode, instead of changing name of a module, change the module of a name!
from collections import OrderedDict
model = # your model
new_layer = # your desired layer
model.__dict__['_modules'] = OrderedDict([(k, new_layer) if k == 'name_of_layer_to_change' else (k, v) for k, v in model.__dict__['_modules'].items()])
Bests