Index out of range in self

Hasan_Khan: <p>In the embedding layer of the model I have defined <strong>vocab size</strong> and a <em>embedding_dim</em> argument, but while printing the summary of the model I’m not getting the exact value of the arguments as set in hyperparameters of the above arguments.</p>
<p>The <strong>embedding_dim</strong> is set to <code>512</code> as of the same length of sequences. I have attached the code and error snippets for better understanding.</p>
<p><strong>Model Architecture</strong><br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/2/3/23534d7e4a026b6a50622ecf8742362767b2d191.png" data-download-href="https://discuss.pytorch.org/uploads/default/23534d7e4a026b6a50622ecf8742362767b2d191" title="image"><img src="https://discuss.pytorch.org/uploads/default/original/3X/2/3/23534d7e4a026b6a50622ecf8742362767b2d191.png" alt="image" data-base62-sha1="52vbzEEZpg7qsW59uyLSGkJ2q9X" width="690" height="266" data-dominant-color="252626"><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">981×379 13.9 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><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/d/2/d26bed24cd5109256acf23a28ea225552a221eeb.png" data-download-href="https://discuss.pytorch.org/uploads/default/d26bed24cd5109256acf23a28ea225552a221eeb" title="image"><img src="https://discuss.pytorch.org/uploads/default/original/3X/d/2/d26bed24cd5109256acf23a28ea225552a221eeb.png" alt="image" data-base62-sha1="u1tuZGitJCo6FkoqMIkvu67JNof" width="690" height="317" data-dominant-color="2D2D2D"><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">944×435 12.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><strong>Error</strong><br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/9/f/9f30a59e93f4880a4744f85e57aa3e5b5695b35f.png" data-download-href="https://discuss.pytorch.org/uploads/default/9f30a59e93f4880a4744f85e57aa3e5b5695b35f" title="image"><img src="https://discuss.pytorch.org/uploads/default/original/3X/9/f/9f30a59e93f4880a4744f85e57aa3e5b5695b35f.png" alt="image" data-base62-sha1="mIg8ThmMlHoLhJi2WkE4xFZFAh9" width="690" height="287" data-dominant-color="3D3D3E"><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">1141×475 23.5 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>

Vidit_Agarwal: <p>While declaring the class the order in which you are passing self, and other parameters and the order in which you are actually passing at time of declaration should be in same order or else it should be passed like &lt;parameter_name&gt;=&lt;parameter_variable&gt;</p>
<p>So one way is</p>
<p>network = RNNClassifier(embedding_dim, hidden_dim, layer_dim, vocab_size, output_dim)</p>

Hasan_Khan: <p>ohhh, yes. I havent seen that. Very embarrassing. Thank you!</p>

Hasan_Khan: <p>However, I’m facing this other error</p>
<p>embedding(): argument ‘indices’ (position 2) must be Tensor, not tuple</p>
<p>I have converted the<code> max_features</code> to <strong>tensor type</strong> using <code>torch.tensor</code> but still the same error occurs. This <strong>max_features</strong> is the total <strong>vocab_size</strong> which I’m passing to the embedding layer.<br>
Please, help me figure out this issue as well.</p>