Input to CNN Pytorch error: Given groups=1, weight of size [16, 3, 5, 5, 5], expected input[1, 100, 3, 256, 256] to have 3 channels, but got 100 channels instead

username: Arya_Mathew
cooked: <p>The aim is to create a CNN in pytorch for RGB(256x256) images. I am performing a regression task. The images are in the form of numpy arrays. I have made a custom Pytorch dataset using pytorch.utilis.data.Dataset to take in the images and the target values. The dataset is loaded in batches of size 100 using DataLoader. So the inputs should of the form [100,3,256,256]. But the error says the input is of the form [1,100,3,256,256]. I don’t know where I have gone wrong.<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/b/5/b58950b8b25f28f2ffaf4ac1a58eefe0ac800fcf.png" data-download-href="https://discuss.pytorch.org/uploads/default/b58950b8b25f28f2ffaf4ac1a58eefe0ac800fcf" title="Screenshot 2023-03-26 at 17.17.02"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/b/5/b58950b8b25f28f2ffaf4ac1a58eefe0ac800fcf_2_690x55.png" alt="Screenshot 2023-03-26 at 17.17.02" data-base62-sha1="pTWCmUzxuNNvTPYQngS9Ypimpzx" width="690" height="55" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/b/5/b58950b8b25f28f2ffaf4ac1a58eefe0ac800fcf_2_690x55.png, https://discuss.pytorch.org/uploads/default/optimized/3X/b/5/b58950b8b25f28f2ffaf4ac1a58eefe0ac800fcf_2_1035x82.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/b/5/b58950b8b25f28f2ffaf4ac1a58eefe0ac800fcf_2_1380x110.png 2x" data-dominant-color="F6F5F5"><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">Screenshot 2023-03-26 at 17.17.02</span><span class="informations">2186×176 26.8 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></p>

username: Arya_Mathew
cooked: <p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/e/9/e93010ac87f5a0db67106a46e4e55026897db933.png" data-download-href="https://discuss.pytorch.org/uploads/default/e93010ac87f5a0db67106a46e4e55026897db933" title="Screenshot 2023-03-26 at 17.17.44"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/e/9/e93010ac87f5a0db67106a46e4e55026897db933_2_690x150.png" alt="Screenshot 2023-03-26 at 17.17.44" data-base62-sha1="xgSeeUGidHmhAAPh7bsntWTxlF9" width="690" height="150" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/e/9/e93010ac87f5a0db67106a46e4e55026897db933_2_690x150.png, https://discuss.pytorch.org/uploads/default/optimized/3X/e/9/e93010ac87f5a0db67106a46e4e55026897db933_2_1035x225.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/e/9/e93010ac87f5a0db67106a46e4e55026897db933_2_1380x300.png 2x" data-dominant-color="F2F3F2"><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">Screenshot 2023-03-26 at 17.17.44</span><span class="informations">2210×482 54.7 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></p>

username: Arya_Mathew
cooked: <p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/3/3/335c8bada63540e49f978f737b669919c75aa3ff.png" data-download-href="https://discuss.pytorch.org/uploads/default/335c8bada63540e49f978f737b669919c75aa3ff" title="Screenshot 2023-03-26 at 17.18.18"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/3/3/335c8bada63540e49f978f737b669919c75aa3ff_2_690x367.png" alt="Screenshot 2023-03-26 at 17.18.18" data-base62-sha1="7kmD081B9vxJLOgVWXzXAnzDiph" width="690" height="367" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/3/3/335c8bada63540e49f978f737b669919c75aa3ff_2_690x367.png, https://discuss.pytorch.org/uploads/default/optimized/3X/3/3/335c8bada63540e49f978f737b669919c75aa3ff_2_1035x550.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/3/3/335c8bada63540e49f978f737b669919c75aa3ff_2_1380x734.png 2x" data-dominant-color="F5F5F5"><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">Screenshot 2023-03-26 at 17.18.18</span><span class="informations">2216×1180 236 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></p>

username: Arya_Mathew
cooked: <p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/c/2/c2156a1e4555add49ffffed6be78044ca55e9783.png" data-download-href="https://discuss.pytorch.org/uploads/default/c2156a1e4555add49ffffed6be78044ca55e9783" title="Screenshot 2023-03-26 at 17.19.06"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/c/2/c2156a1e4555add49ffffed6be78044ca55e9783_2_689x254.png" alt="Screenshot 2023-03-26 at 17.19.06" data-base62-sha1="rGWvBbAP8PwvLaS3B4Wg4dCS1Pl" width="689" height="254" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/c/2/c2156a1e4555add49ffffed6be78044ca55e9783_2_689x254.png, https://discuss.pytorch.org/uploads/default/optimized/3X/c/2/c2156a1e4555add49ffffed6be78044ca55e9783_2_1033x381.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/c/2/c2156a1e4555add49ffffed6be78044ca55e9783_2_1378x508.png 2x" data-dominant-color="F1F1F1"><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">Screenshot 2023-03-26 at 17.19.06</span><span class="informations">2212×816 112 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></p>

username: Arya_Mathew
cooked: <p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/2/b/2bb11d40900c3e9794e132f2921ee6ea8a4c033f.png" data-download-href="https://discuss.pytorch.org/uploads/default/2bb11d40900c3e9794e132f2921ee6ea8a4c033f" title="Screenshot 2023-03-26 at 17.19.43"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/2/b/2bb11d40900c3e9794e132f2921ee6ea8a4c033f_2_690x323.png" alt="Screenshot 2023-03-26 at 17.19.43" data-base62-sha1="6evZNG9It0aUlJFu1BOmK0SQRSn" width="690" height="323" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/2/b/2bb11d40900c3e9794e132f2921ee6ea8a4c033f_2_690x323.png, https://discuss.pytorch.org/uploads/default/optimized/3X/2/b/2bb11d40900c3e9794e132f2921ee6ea8a4c033f_2_1035x484.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/2/b/2bb11d40900c3e9794e132f2921ee6ea8a4c033f_2_1380x646.png 2x" data-dominant-color="F4F4F4"><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">Screenshot 2023-03-26 at 17.19.43</span><span class="informations">2248×1054 281 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></p>

username: eqy
cooked: <p>Calling <code>torch.squeeze</code> on <code>images</code> should workaround the issue but I recommend printing the shape during each step of dataloading to see where the extra dimension is added.</p>