A note for anyone else who might go looking for the source of the formula referenced by the O.P.  It is from A guide to convolution arithmetic for deep learning 43 with accompanying repository at https://github.com/vdumoulin/conv_arithmetic 22