# Custom Conv2d Operation

**URL:** <https://discuss.pytorch.org/t/custom-conv2d-operation/90003>\
**Category:** vision\
**Created:** [July 21, 2020, 8:53am UTC](https://discuss.pytorch.org/t/custom-conv2d-operation/90003 "2020-07-21T08:53:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![eslammofreh](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/e/9de053/32.png) [@eslammofreh](https://discuss.pytorch.org/u/eslammofreh)\
**Post date:** [July 21, 2020, 8:53am UTC](https://discuss.pytorch.org/t/custom-conv2d-operation/90003/1 "2020-07-21T08:53:45Z")

</div>

How to write my custom Conv2d layer ?  
I want to do some transformations on the convolved part of the image before convolution.

---

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [July 23, 2020, 6:17am UTC](https://discuss.pytorch.org/t/custom-conv2d-operation/90003/2 "2020-07-23T06:17:10Z")

</div>

You could use `unfold` for your custom convolution (which might be slow) as described [here](https://discuss.pytorch.org/t/custom-nn-conv2d/62068/2).

---

<div class="post-metadata">

**Author:** ![narain1](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/narain1/32/27026_2.png) [@narain1](https://discuss.pytorch.org/u/narain1)\
**Post date:** [July 23, 2020, 8:22am UTC](https://discuss.pytorch.org/t/custom-conv2d-operation/90003/3 "2020-07-23T08:22:08Z")

</div>

![Opera Snapshot_2020-07-22_154551_www.kaggle.com](https://discuss.pytorch.org/uploads/default/original/3X/4/e/4e30fe4d117f49cf902987a1ef6a66bdeabb8a70.png)

[link to the competition solution discussion](https://www.kaggle.com/c/alaska2-image-steganalysis/discussion/168548)

can you help me with what the convolution and maxpool with no stride mean

- thanks

---

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [July 23, 2020, 10:06am UTC](https://discuss.pytorch.org/t/custom-conv2d-operation/90003/4 "2020-07-23T10:06:51Z")

</div>

I don’t know, what “I removed the stride in the first conv layer and max-pooling layer” means.  
Maybe a custom stride was removed and the default one was used?

As it’s the 1st place solution, I assume that the code has to be released (to get the prize). You could also ask the author directly, what she meant by this setup. 😉
