Knet.jl icon indicating copy to clipboard operation
Knet.jl copied to clipboard

deconv/unpool default output size not always correct

Open denizyuret opened this issue 3 years ago • 2 comments

Multiple x sizes can lead to the same y size in conv and pool operations. Our current API picks one in the deconv and unpool implementations. Check out whether other frameworks use the same default and how we can give the user the option to pick different sizes in the API.

denizyuret avatar Dec 10 '20 14:12 denizyuret

Tensorflow needs an output size to be specified. However, Pytorch does not need an output size to be specified according to their definitions here: https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/nn/conv3d_transpose https://pytorch.org/docs/stable/generated/torch.nn.ConvTranspose3d.html The Pytorch implementation, however, takes arguments to add zero paddings to one (specified by 'output_padding' argument) or both sides (specified by 'padding' argument) to get a desired output shape. More information about the output shape and padding is available on the PyTorch link above. However, I think specifying the output shape and adding the 'SAME' padding as in tensorflow implementation seems more user friendly.

basitanees avatar Dec 17 '20 01:12 basitanees

The PyTorch implementation also takes an optional output size parameter which calculates/ modifies the 'output_padding' parameter to match the output size specified by the user as can be checked here: https://pytorch.org/docs/stable/_modules/torch/nn/modules/conv.html#ConvTranspose2d

basitanees avatar Dec 17 '20 01:12 basitanees