# How to convert Keras' "same" padding for Conv2DTranspose in Pytorch

**URL:** <https://discuss.pytorch.org/t/how-to-convert-keras-same-padding-for-conv2dtranspose-in-pytorch/101240>\
**Category:** vision\
**Created:** [November 1, 2020, 8:30am UTC](https://discuss.pytorch.org/t/how-to-convert-keras-same-padding-for-conv2dtranspose-in-pytorch/101240 "2020-11-01T08:30:37Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Abhilash\_Srivastava](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/abhilash_srivastava/32/33127_2.png) [@Abhilash\_Srivastava](https://discuss.pytorch.org/u/Abhilash_Srivastava)\
**Post date:** [November 1, 2020, 8:48am UTC](https://discuss.pytorch.org/t/how-to-convert-keras-same-padding-for-conv2dtranspose-in-pytorch/101240/2 "2020-11-01T08:48:55Z")

</div>

From what I know, Pytorch doesn’t support this as an inbuilt option, TensorFlow does. Checkout this [discussion](https://github.com/pytorch/pytorch/issues/3867#issuecomment-507010696) which mentions how dynamic loading makes it hard.  
However, there could be ways to hack it by combining asymmtric padding layers with conv2d layers. I wouldn’t bother doing it, unless super useful and just go with the inbuilt padding options. More discussion [here](https://discuss.pytorch.org/t/is-asymmetric-padding-of-style-same-available-in-pytorch/4354/8).

---

_[View the full topic](https://discuss.pytorch.org/t/how-to-convert-keras-same-padding-for-conv2dtranspose-in-pytorch/101240)._
