RuntimeError: The expanded size of the tensor (1) must match the existing size (2432) at non-singleton dimension 1. Target sizes: [2432, 1, 256]. Tensor sizes: [1, 2432, 1]

username: monee_h.a
cooked: <p>Hi,</p>
<p>I am getting the following error when performing the GAT operator specifically in “loss = train (,)” line:</p>
<p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/d/a/dab579d4d1482928a3a1128343eb5b6fc8365549.png" data-download-href="https://discuss.pytorch.org/uploads/default/dab579d4d1482928a3a1128343eb5b6fc8365549" title="Screen Shot 2021-06-02 at 12.09.37 AM"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/d/a/dab579d4d1482928a3a1128343eb5b6fc8365549_2_690x112.png" alt="Screen Shot 2021-06-02 at 12.09.37 AM" data-base62-sha1="vcMTJkdpGbek2NOlTMzN6LW28TD" width="690" height="112" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/d/a/dab579d4d1482928a3a1128343eb5b6fc8365549_2_690x112.png, https://discuss.pytorch.org/uploads/default/original/3X/d/a/dab579d4d1482928a3a1128343eb5b6fc8365549.png 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/d/a/dab579d4d1482928a3a1128343eb5b6fc8365549.png 2x" data-dominant-color="C9CCCC"><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">Screen Shot 2021-06-02 at 12.09.37 AM</span><span class="informations">1011×165 35.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>
<p>This is what train does:<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/b/a/ba7c42570316da2d6f4f8125b1a994e453c02c73.png" data-download-href="https://discuss.pytorch.org/uploads/default/ba7c42570316da2d6f4f8125b1a994e453c02c73" title="Screen Shot 2021-06-02 at 12.09.26 AM"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/b/a/ba7c42570316da2d6f4f8125b1a994e453c02c73_2_690x190.png" alt="Screen Shot 2021-06-02 at 12.09.26 AM" data-base62-sha1="qBJ24I4KddpLaEMwDXwI1raZquL" width="690" height="190" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/b/a/ba7c42570316da2d6f4f8125b1a994e453c02c73_2_690x190.png, https://discuss.pytorch.org/uploads/default/original/3X/b/a/ba7c42570316da2d6f4f8125b1a994e453c02c73.png 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/b/a/ba7c42570316da2d6f4f8125b1a994e453c02c73.png 2x" data-dominant-color="EBECEC"><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">Screen Shot 2021-06-02 at 12.09.26 AM</span><span class="informations">869×240 34.2 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>
<p>Full error:</p>
<p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/0/7/0739de70adbd4e12ee3d4c2d971c9e497f7ef319.png" data-download-href="https://discuss.pytorch.org/uploads/default/0739de70adbd4e12ee3d4c2d971c9e497f7ef319" title="Screen Shot 2021-06-02 at 12.09.51 AM"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/0/7/0739de70adbd4e12ee3d4c2d971c9e497f7ef319_2_680x500.png" alt="Screen Shot 2021-06-02 at 12.09.51 AM" data-base62-sha1="11VkcAbLFzCvmDAn6iUf6GDVnm1" width="680" height="500" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/0/7/0739de70adbd4e12ee3d4c2d971c9e497f7ef319_2_680x500.png, https://discuss.pytorch.org/uploads/default/original/3X/0/7/0739de70adbd4e12ee3d4c2d971c9e497f7ef319.png 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/0/7/0739de70adbd4e12ee3d4c2d971c9e497f7ef319.png 2x" data-dominant-color="F4F5F5"><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">Screen Shot 2021-06-02 at 12.09.51 AM</span><span class="informations">1008×741 136 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>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/5/7/5784e9b3b460c014702f58a3bc5827f32b07034e.png" data-download-href="https://discuss.pytorch.org/uploads/default/5784e9b3b460c014702f58a3bc5827f32b07034e" title="Screen Shot 2021-06-02 at 12.10.03 AM"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/5/7/5784e9b3b460c014702f58a3bc5827f32b07034e_2_690x498.png" alt="Screen Shot 2021-06-02 at 12.10.03 AM" data-base62-sha1="cueiSuYl5iIR80TWvphLzJMKyYe" width="690" height="498" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/5/7/5784e9b3b460c014702f58a3bc5827f32b07034e_2_690x498.png, https://discuss.pytorch.org/uploads/default/original/3X/5/7/5784e9b3b460c014702f58a3bc5827f32b07034e.png 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/5/7/5784e9b3b460c014702f58a3bc5827f32b07034e.png 2x" data-dominant-color="F3F5F5"><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">Screen Shot 2021-06-02 at 12.10.03 AM</span><span class="informations">1018×736 125 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>
<p>Could you please help me out to solve this error. Thank you!</p>

username: ptrblck
cooked: <p>The error is raised in the <code>src.expand_as(other)</code> operation, since the shape of <code>other</code> cannot be used to <code>expand</code> <code>src</code>, so you would need to check the input shapes for this particular operation and make sure they match the expected shapes.</p>
<p>PS: you can post code snippets by wrapping them into three backticks ```, which would make debugging easier and would also allow the forum search to index the code.</p>

username: monee_h.a
cooked: <p>Thank you for your reply.</p>