Dimensional Error

username: harshini_sewani
cooked: <p>Hello Everyone,<br>
I am implementing a hybrid model which is autoencoder and CNN. I am attaching an image of my error which says I am not giving the dimension to my CNN proper. Please help me out to understand what can I do to get rid of this error. I am using Pytorch to implement the above models. <div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/a/5/a5bb31d595fb38e171304a35fdfc63aa102f78b9.png" data-download-href="https://discuss.pytorch.org/uploads/default/a5bb31d595fb38e171304a35fdfc63aa102f78b9" title="1"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/a/5/a5bb31d595fb38e171304a35fdfc63aa102f78b9_2_690x288.png" alt="1" data-base62-sha1="nE7QpvlqB5KUXbFowD6kOqZfcRr" width="690" height="288" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/a/5/a5bb31d595fb38e171304a35fdfc63aa102f78b9_2_690x288.png, https://discuss.pytorch.org/uploads/default/optimized/3X/a/5/a5bb31d595fb38e171304a35fdfc63aa102f78b9_2_1035x432.png 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/a/5/a5bb31d595fb38e171304a35fdfc63aa102f78b9.png 2x" data-dominant-color="FDFDFE"><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">1</span><span class="informations">1358×567 10.1 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: harsha_g
cooked: <p><a class="mention" href="/u/harshini_sewani">@harshini_sewani</a> Can you paste your model along with the input shapes to precisely figure out what’s going on?</p>

username: harshini_sewani
cooked: <p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/8/e/8e0405ffb40e253b49bac095101b5951f8f80c6a.png" data-download-href="https://discuss.pytorch.org/uploads/default/8e0405ffb40e253b49bac095101b5951f8f80c6a" title="2"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/8/e/8e0405ffb40e253b49bac095101b5951f8f80c6a_2_690x288.png" alt="2" data-base62-sha1="kgkq6cJGfXsi4hANjWlpNqzsytc" width="690" height="288" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/8/e/8e0405ffb40e253b49bac095101b5951f8f80c6a_2_690x288.png, https://discuss.pytorch.org/uploads/default/optimized/3X/8/e/8e0405ffb40e253b49bac095101b5951f8f80c6a_2_1035x432.png 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/8/e/8e0405ffb40e253b49bac095101b5951f8f80c6a.png 2x" data-dominant-color="FAFAFA"><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">2</span><span class="informations">1358×567 21.4 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: harsha_g
cooked: <p>Thanks! Can you also provide your <code>fc_encoder</code> definition?</p>

username: harshini_sewani
cooked: <p><img src="https://discuss.pytorch.org/uploads/default/original/3X/b/4/b45b59c56aafa279cca9308edb7c8643bf74a30a.png" alt="image" data-base62-sha1="pJvF4YI5LCSvz1DAxFGjrK3C36a" width="479" height="173"></p>

username: harsha_g
cooked: <p>The issue is that assuming an input <code>x</code> of shape <code>(N,1,H_in)</code> is fed to your <code>fc_encoder</code>, you get an output of shape <code>(N,1,H_out)</code>. This shape is then feasible to be fed into your <code>Conv1d</code> layer. However, it seems the shape of the tensor being fed into this layer is <code>[1, 4975]</code>. So, please ensure your input is shaped <code>(N, 1, H_in)</code>.</p>

username: harshini_sewani
cooked: <p>Can you please explain me what is use of batch normalization and evolving normalization-activation layer ?</p>

username: harshini_sewani
cooked: <p>How can i reshape it ?</p>