PyramidNet to PyTorch

I would like to translate [PyramidNet] (https://github.com/jhkim89/PyramidNet) to pytorch. They provide pretrained model in Torch but using any automatic converter to PyTorch does not work because of lack ‘nn.Padding’.

It is exactly because of line: https://github.com/jhkim89/PyramidNet/blob/master/mulpyramidnet.lua#L40

if nInputPlane ~= nOutputPlane then
         short:add(nn.Padding(1, (nOutputPlane - nInputPlane), 3))

This line add padding in ‘Channels’ size (so not width and height as usuall). And I found that currently it is not possible at PyTorch as all Padding utils make an assumption that only width and height can be padded.

I could just change orded of tensor (from C-W-H to W-H-C) and then pad channels, but it is the right approach?

1 Like