Body: <p>GRU belongs to the family of recurrent neural networks. This family of neural networks works on sequence data.</p>
  <p>But, it is taking time for me to understand the differences between sequence length and input in the case of a GRU cell.</p>
  <p>In the case of a CNN, the input tensor is of the form <span class="math-container">$B \times C \times H \times W$</span>.  Here <span class="math-container">$B$</span> is the batch size, <span class="math-container">$C$</span> is the number of channels, <span class="math-container">$H$</span> is the height of the image and <span class="math-container">$W$</span> is the width of the image.</p>
  <p>We can visualize the input and outputs of CNN <a href="https://alexlenail.me/NN-SVG/LeNet.html" rel="nofollow noreferrer">here</a>.</p>
  <p>Similarly, in the case of a GRU layer, the <a href="https://pytorch.org/docs/stable/generated/torch.nn.GRU.html" rel="nofollow noreferrer">input tensor</a> is of the form <span class="math-container">$B  \times L \times I$</span>. Here <span class="math-container">$B$</span> is the batch size, <span class="math-container">$L$</span> is the length of the sequence and <span class="math-container">$I$</span> is the number of input features.</p>
  <p>I want to know what exactly the input and sequence lengths are. If there are any visualizations, please provide them.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-03-06T00:02:25.093Z
Comments.Text: If we're using embeddings, $I$ might be the embedding size. If you're using the GRU for machine translation, $L$ is probably the maximum number of words that you expect in a sentence. I suppose this is the answer to your question, but I am not sure. Can you please provide a source that describes the input of the GRU unit as a tensor of shape $B \times L \times I$?
Comments.UserDisplayName: nbro
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-03-06T23:21:17.027Z
Comments.Text: @nbro I think you missed the link from the comment.
Comments.UserDisplayName: hanugm
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-03-06T23:22:10.370Z
Comments.Text: @nbro I updated the link.
Comments.UserDisplayName: hanugm
Tags: <resource-request><gated-recurrent-unit>
Title: How to visualize the input and output of the GRU cell?
UserDisplayName: hanugm
ThreadText: # How to visualize the input and output of the GRU cell?
  
  (Asked by: username_0 on 2022-03-03)
  
  GRU belongs to the family of recurrent neural networks. This family of neural networks works on sequence data.
  
  But, it is taking time for me to understand the differences between sequence length and input in the case of a GRU cell.
  
  In the case of a CNN, the input tensor is of the form $B \times C \times H \times W$. Here $B$ is the batch size, $C$ is the number of channels, $H$ is the height of the image and $W$ is the width of the image.
  
  We can visualize the input and outputs of CNN [here](https://alexlenail.me/NN-SVG/LeNet.html).
  
  Similarly, in the case of a GRU layer, the [input tensor](https://pytorch.org/docs/stable/generated/torch.nn.GRU.html) is of the form $B \times L \times I$. Here $B$ is the batch size, $L$ is the length of the sequence and $I$ is the number of input features.
  
  I want to know what exactly the input and sequence lengths are. If there are any visualizations, please provide them.
  
  **Tags:** resource-request, gated-recurrent-unit
  > **Comments:**
  > **username_1**: If we're using embeddings, $I$ might be the embedding size. If you're using the GRU for machine translation, $L$ is probably the maximum number of words that you expect in a sentence. I suppose this is the answer to your question, but I am not sure. Can you please provide a source that describes the input of the GRU unit as a tensor of shape $B \times L \times I$?  
  > **username_0**: @nbro I think you missed the link from the comment.  
  > **username_0**: @nbro I updated the link.  
  
  ---
  
  ## 0 answers
  
  