When I try the code below:
import torch
import torch.legacy.nn as lnn
import torch.nn as nn

import torchvision
import torchvision.models as models


cnn = models.vgg19(pretrained=True)#.features
print(cnn)

for idx, module in cnn.features._modules.items():
	if module.__class__.__name__ == 'ReLU':
            print("ReLU!")
        if module.__class__.__name__ == 'Conv2d':
            print("Conv!")
            cnn.features._modules[idx] = lnn.SpatialConvolution
        if module.__class__.__name__ == 'MaxPool2d':
            print("Pool!")
            cnn.features._modules[idx] = lnn.SpatialMaxPooling

print(cnn)

I get this error when I run print(cnn) after changing the layers:
TypeError: unbound method __repr__() must be called with SpatialConvolution instance as first argument (got nothing instead)