I want to change the Conv2d layers into SpatialConvolution layers, and the MaxPool2d layers into SpatialMaxPooling layers:
Conv2d --> SpatialConvolution

MaxPool2d --> SpatialMaxPooling

If I load the model like this:
import torch.legacy.nn as lnn
import torch.nn as nn

cnn = models.vgg19(pretrained=True)

Then how do I perform the above changes?
I am not sure if I need anything like the cfg dictionary from this script: https://github.com/pytorch/vision/blob/master/torchvision/models/vgg.py
This is PyTorch’s legacy SpatialConvolution code: https://github.com/pytorch/pytorch/blob/master/torch/legacy/nn/SpatialConvolution.py 5
The non legacy Conv code is found here: https://github.com/pytorch/pytorch/blob/master/torch/nn/modules/conv.py 3
This is PyTorch’s legacy SpatialMaxPooling code: https://github.com/pytorch/pytorch/blob/master/torch/legacy/nn/SpatialMaxPooling.py 3
The non legacy pooling code is found here: https://github.com/pytorch/pytorch/blob/master/torch/nn/modules/pooling.py 1