Why the default dilation value in Conv2d is 1?

username: xwzy
cooked: <p>class torch.nn.Conv2d(in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True)</p>
<p>The default value of dilation = 1, does it means all the conv2d without setting dilation = 0 will use dilation conv?</p>

username: alexis-jacq
cooked: <p>Dilation = 1 already means “no dilation”: 1-spacing = no gaps. I agree this convention is weird…</p>

username: tom
cooked: <aside class="quote no-group" data-username="alexis-jacq" data-post="2" data-topic="5612">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/alexis-jacq/48/180_2.png" class="avatar"> alexis-jacq:</div>
<blockquote>
<p>Dilation = 1</p>
</blockquote>
</aside>
<p>If you phrase it as “every <code>dilation</code>th element is used”, it may be easier to remember. When defining dilation (or any op in general) to me it seems natural to talk about what is used/done rather than what is skipped/not done.<br>
So once you try to write down a formula, it probably is with this convention. Using it in code saves you from index juggling when putting formulas into code.</p>
<p>Of course, everyone has a different intuition about these things, but personally, I think the one pytorch implicitly suggests here can be useful.</p>
<p>Best regards</p>
<p>Thomas</p>

username: smth
cooked: <p>dilation is similar to stride. stride=1 is not weird, and hence dilation=1 is not weird either <img src="//discuss.pytorch.org/images/emoji/apple/slight_smile.png?v=5" title=":slight_smile:" class="emoji" alt=":slight_smile:"></p>

username: alexis-jacq
cooked: <p>Ok, please forgive my words, “weird” wasn’t the appropriate formulation. But it can be misunderstood by thinking that ‘=1’ implies there is a dilating dilation, hence the existence of this topic…</p>

username: shirui-japina
cooked: <p>So in PyTorch, which image can represent the correct understanding?<br>
Which image is the correct understanding of <strong>dilation value = 1</strong>?</p>
<p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/d/5/d538c827c91f49fdc0f301e622ee903f89a17610.png" data-download-href="https://discuss.pytorch.org/uploads/default/d538c827c91f49fdc0f301e622ee903f89a17610" title="1446032-20190426165728998-932168491"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/d/5/d538c827c91f49fdc0f301e622ee903f89a17610_2_345x243.png" alt="1446032-20190426165728998-932168491" data-base62-sha1="uqfm3AKYS0nH98YWy6JBqEHjgIg" width="345" height="243" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/d/5/d538c827c91f49fdc0f301e622ee903f89a17610_2_345x243.png, https://discuss.pytorch.org/uploads/default/optimized/3X/d/5/d538c827c91f49fdc0f301e622ee903f89a17610_2_517x364.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/d/5/d538c827c91f49fdc0f301e622ee903f89a17610_2_690x486.png 2x" data-dominant-color="ECF0F3"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">1446032-20190426165728998-932168491</span><span class="informations">896×632 63 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div><br>
<img src="https://discuss.pytorch.org/uploads/default/original/3X/e/b/ebfe8acdf5c31c105db15dd2ab84517a6852f3eb.png" alt="1446032-20190426165827108-2055771203" data-base62-sha1="xFHyHxLeSzR017Q2Fbrt7F0yv9N" width="206" height="241"></p>

username: tejasvi88
cooked: <h1>Bottom one</h1>

username: kikki
cooked: <p>stride: step length for moving kernel.<br>
dilation: step length for moving kernel element.</p>

username: Ansh_Upadhyay
cooked: <p>You see the first image has dilation = 2 which means the row and column of the convolving filter is increased by a scale of 2 ( as you can see in the picture; there are 2 additional pixels in the row and columns of the filter).</p>
<p>Now to address the fact that why they keep the default value is 1 (as it should insert a single pixel over a row and column); kernels applied are generally in odd dimension like (3x3, 5x5, 7x7) due to which adding a single pixel in their rows and columns would lead to an unbalanced weighted filter matrix (sure it would be fine for a 2x2 kernel but in general we dont make use of that so it wont).</p>
<p>Now some of you might argue over 'It can be useful in case of Pooling Layer!" ; But you see these layers are just for dimensional reductions which is mostly influeced by the 'kernel_size" and “stride” values. Using Dilation here will lead to a loss of pixel values which may represent important features of our input feature maps.</p>
<p>Hence dilation = 1 (By default) is accepted globally. Well thats how i feel it should be actually!.</p>
<p>Have a Great Day.</p>