I want to implment such padding operations within the pytorch framework.
The traditional padding operations add zero at the boundary of the feature maps.
I am wondering how can I insert zero between the feature map.
Such as I have 5x5 feature map like:
1 2 3 4 5
2 3 4 5 1
3 4 5 1 2
4 5 1 2 3
5 1 2 3 4

Then our target is to insert zero between the values within the feature map and we should support various strides, here we assume the padding stride is one, then we should get the feature map like this,
1 0 2 0 3 0 4 0 5
0 0 0 0 0 0 0 0 0
2 0 3 0 4 0 5 0 1
0 0 0 0 0 0 0 0 0
3 0 4 0 5 0 1 0 2
0 0 0 0 0 0 0 0 0
4 0 5 0 1 0 2 0 3
0 0 0 0 0 0 0 0 0
5 0 1 0 2 0 3 0 4
0 0 0 0 0 0 0 0 0

Could any one show me some cheap method to implement such padding operations?
I find one possible method is to modify the files “pytorch/caffe2/operators/pad_op.cc” and implement a new padding layer to support such operations.