Answers.Body: <p>Noise vector (batch_size, 100, 1, 1) is deconvoloved with filter_1 (100, 4, 4). Result is feature_map_1 (1, 4, 4). And since there are 512 filters, so there will be 512 feature maps. Output shape will be (batch_size, 512, 4, 4).</p>
  <p>I think you need better undersanting for convolutional calculations in general. In this <a href="https://stackoverflow.com/questions/43306323/keras-conv2d-and-input-channels">stack</a> it was explained very well.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-01-02T17:46:47.590Z
Answers.Text: So, yeah, it seems that it works in the way like I suggested in my question. Thx.
Answers.UserDisplayName: CapJS
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-01-02T17:11:28.437Z
Answers.LastActivityDate: 2021-01-02T17:22:48.383Z
Answers.LastEditDate: 2021-01-02T17:22:48.383Z
Answers.UserDisplayName: Enes
Body: <p>I'm working on the code trying to generate new images using DCGAN model. The structure of my code is from the PyTorch tutorial <a href="https://pytorch.org/tutorials/beginner/dcgan_faces_tutorial.html" rel="nofollow noreferrer">here</a>.
  I'm a bit confused trying to find and understand how the latent vector is transforming to the feature map from the Generator part (this line of code is what I'm interested in) :</p>
  <pre><code>nn.ConvTranspose2d(  nz, ngf * 8, 4, 1, 0, bias=False)
  </code></pre>
  <p>It means the latent vector (nz) of shape 100x1 transforming to the 512 matrices of 4x4 size (ngf=64). How  does it happen? Hence, I can't even clear to myself how the length of the latent vector influence to the generated image.
  P.S. The left part of the Genarator structure is clear.</p>
  <p>The only idea that I got is :</p>
  <ol>
  <li>E.g. there is a latent vector of size 100 as input (100 random values).</li>
  <li>We interact each value of the input latent vector with a 4x4 kernel.</li>
  <li>In this way we get 100 different 4x4 matrices (each matrix is for one value from latent vector).</li>
  <li>Then we summarize all these 100 matrices and get one final matrix - one feature map.</li>
  <li>We get necessary number of feature maps taking different kernels.</li>
  </ol>
  <p>Is this right? Or does it happen in other way?</p>
  
Tags: <neural-networks><convolutional-neural-networks><generative-adversarial-networks><dc-gan>
Title: How is the latent vector transforming to a feature map in DCGAN (Generator structure)?
UserDisplayName: CapJS
ThreadText: # How is the latent vector transforming to a feature map in DCGAN (Generator structure)?
  
  (Asked by: username_0 on 2021-01-02)
  
  I'm working on the code trying to generate new images using DCGAN model. The structure of my code is from the PyTorch tutorial here.
  I'm a bit confused trying to find and understand how the latent vector is transforming to the feature map from the Generator part (this line of code is what I'm interested in) :
  nn.ConvTranspose2d(  nz, ngf * 8, 4, 1, 0, bias=False)
  
  It means the latent vector (nz) of shape 100x1 transforming to the 512 matrices of 4x4 size (ngf=64). How  does it happen? Hence, I can't even clear to myself how the length of the latent vector influence to the generated image.
  P.S. The left part of the Genarator structure is clear.
  The only idea that I got is :
  
  E.g. there is a latent vector of size 100 as input (100 random values).
  We interact each value of the input latent vector with a 4x4 kernel.
  In this way we get 100 different 4x4 matrices (each matrix is for one value from latent vector).
  Then we summarize all these 100 matrices and get one final matrix - one feature map.
  We get necessary number of feature maps taking different kernels.
  
  Is this right? Or does it happen in other way?
  
  **Tags:** neural-networks, convolutional-neural-networks, generative-adversarial-networks, dc-gan
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-01-02. Score: 0 | Accepted answer
  
  Noise vector (batch\_size, 100, 1, 1) is deconvoloved with filter\_1 (100, 4, 4). Result is feature\_map\_1 (1, 4, 4). And since there are 512 filters, so there will be 512 feature maps. Output shape will be (batch\_size, 512, 4, 4).
  
  I think you need better undersanting for convolutional calculations in general. In this [stack](https://stackoverflow.com/questions/43306323/keras-conv2d-and-input-channels) it was explained very well.
  
  > **Comments:**
  > **username_0**: So, yeah, it seems that it works in the way like I suggested in my question. Thx.  
  
  ---
  
  