Varitational Autoencoder

mayurat22: <p>I am trying to build a Variational Autoencoder from Scratch and stuck at a problem with dimensions.</p>
<p>Below Architecture:<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/f/c/fcbb13879ca78882e39171cf1f90d6e56d42a9e0.png" data-download-href="https://discuss.pytorch.org/uploads/default/fcbb13879ca78882e39171cf1f90d6e56d42a9e0" title="image"><img src="https://discuss.pytorch.org/uploads/default/original/3X/f/c/fcbb13879ca78882e39171cf1f90d6e56d42a9e0.png" alt="image" data-base62-sha1="A3L8a4im35uF3uMu98Jrp0rwtgs" width="690" height="240" data-dominant-color="EDEDED"><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">image</span><span class="informations">812×283 40 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>Variational Autoencoder Class:<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/1/e/1e5f41c9e1705f780b632d158160883ba67f561d.png" data-download-href="https://discuss.pytorch.org/uploads/default/1e5f41c9e1705f780b632d158160883ba67f561d" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/1/e/1e5f41c9e1705f780b632d158160883ba67f561d_2_690x480.png" alt="image" data-base62-sha1="4kGpuUgdq07PP4XL8XMkUd70kB7" width="690" height="480" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/1/e/1e5f41c9e1705f780b632d158160883ba67f561d_2_690x480.png, https://discuss.pytorch.org/uploads/default/optimized/3X/1/e/1e5f41c9e1705f780b632d158160883ba67f561d_2_1035x720.png 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/1/e/1e5f41c9e1705f780b632d158160883ba67f561d.png 2x" data-dominant-color="EDEEF0"><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">image</span><span class="informations">1111×774 127 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>Issue:<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/7/2/72e5d742abdcac935558ff15c7864a379d949bbb.png" data-download-href="https://discuss.pytorch.org/uploads/default/72e5d742abdcac935558ff15c7864a379d949bbb" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/7/2/72e5d742abdcac935558ff15c7864a379d949bbb_2_690x435.png" alt="image" data-base62-sha1="goqRwVzXXQsBoztKR9WIYiQnp8v" width="690" height="435" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/7/2/72e5d742abdcac935558ff15c7864a379d949bbb_2_690x435.png, https://discuss.pytorch.org/uploads/default/optimized/3X/7/2/72e5d742abdcac935558ff15c7864a379d949bbb_2_1035x652.png 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/7/2/72e5d742abdcac935558ff15c7864a379d949bbb.png 2x" data-dominant-color="F9DBDA"><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">image</span><span class="informations">1280×807 107 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>I am not sure why decoder is expecting (64, 64, 3, 3) ?<br>
Help me out <img src="https://discuss.pytorch.org/images/emoji/apple/slight_smile.png?v=12" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>

Usama_Hasan: <p>Hy <a class="mention" href="/u/mayurat22">@mayurat22</a> Can you post the code of your training section also.</p>

suraj.pt: <p>Can you try reshaping with batch size = 1? Like<br>
<code>x = x.reshape((1,64,7,7))</code></p>

mayurat22: <p><img src="https://discuss.pytorch.org/uploads/default/original/3X/a/6/a63b5967abf74d30425cfd7f58204f33c194d6d8.png" alt="image" data-base62-sha1="nIypKdUbHYospi0MgmVqbXuo5Kw" width="661" height="378"></p>

mayurat22: <p>It worked. Thank you.</p>