szymonmaszke / torchlayers

Shape and dimension inference (Keras-like) for PyTorch layers and neural networks
MIT License
568 stars 46 forks source link

convolution padding same on even-valued arguments #6

Open triwahyuu opened 4 years ago

triwahyuu commented 4 years ago

is there any possibility for the 'same' padding convolution to work on even values of kernel size, stride, and dilation?

szymonmaszke commented 4 years ago

See PyTorch's Feature Request, in case of torchlayers there are also some quirks one would have to solve as well.

same padding for even values would have to be done by adding asymmetric padding before convolution with one of specific modes (see here). I'm not yet sure how I'd like to follow through with this (some 3D, 1D layers are missing for some padding modes, so I might have to implement my own new layer padding any dimension).

Should be possible to do though, will sit on it during the weekend and keep you updated if anything changes.

triwahyuu commented 4 years ago

thanks for the answer. I still don't quite understand what the padding argument in the convolution really