LSTM Error: lstm() received an invalid combination of arguments

verance: <p>Hello, I am trying to implement a LSTM but I am getting an error when running the <code>forward</code> function.</p>
<p>I intialized my model like this:</p>
<p><code>m = nn.LSTM(input_size = 8, hidden_size = 128, num_layers = 1,dropout=0.1,bidirectional=0,batch_first=True)</code></p>
<p>And then, when doing this:</p>
<p><code>m.forward(batch[0])</code></p>
<p>I get the following error:</p>
<blockquote>
<p>lstm() received an invalid combination of arguments - got (Tensor, tuple, list, bool, int, float, bool, int, bool), but expected one of:</p>
<ul>
<li>(Tensor data, Tensor batch_sizes, tuple of Tensors hx, tuple of Tensors params, bool has_biases, int num_layers, float dropout, bool train, bool bidirectional)<br>
didn’t match because some of the arguments have invalid types: (Tensor, !tuple!, !list!, !bool!, !int!, !float!, !bool!, !int!, bool)</li>
<li>(Tensor input, tuple of Tensors hx, tuple of Tensors params, bool has_biases, int num_layers, float dropout, bool train, bool bidirectional, bool batch_first)<br>
didn’t match because some of the arguments have invalid types: (Tensor, !tuple!, !list!, bool, int, float, bool, !int!, bool)</li>
</ul>
</blockquote>
<p>My batch[0] data:</p>
<pre><code class="lang-auto">tensor([[[   0.,    0.,    0.,    0.,    0.,    0.,    0.,    0.],
         [  20.,    0.,    0.,    0.,    0.,    0.,    0.,    0.],
         [  65.,    0.,    0.,    0.,    0.,    0.,    0.,    0.],
         [ 118.,    0.,    0.,    0.,    0.,    0.,    0.,    0.],
         [ 165.,    0.,    0.,    0.,    0.,    0.,    0.,    0.],
         [-269.,    0.,    0.,    0.,    0.,    0.,    0.,    0.],
         [-269.,    0.,    0.,    0.,    0.,    0.,    0.,    0.],
         [ 175.,    0.,    0.,    0.,    0.,    0.,    0.,    0.],
         [ 243.,    0.,    0.,    0.,    0.,    0.,    0.,    0.],
         [ 214.,    0.,    0.,    0.,    0.,    0.,    0.,    0.],
         [ 559.,    0.,    0.,    0.,    0.,    0.,    0.,    0.],
         [ 617.,    0.,    0.,    0.,    1.,    0.,    0.,    0.],
         [-269.,    0.,    0.,    1.,    0.,    0.,    0.,    0.],
         [-269.,    0.,    1.,    0.,    0.,    0.,    0.,    0.],
         [-269.,    1.,    0.,    0.,    0.,    0.,    0.,    0.],
         [ 437.,    0.,    0.,    0.,    0.,    1.,    0.,    0.],
         [ 396.,    0.,    0.,    0.,    0.,    0.,    1.,    0.],
         [ 517.,    0.,    0.,    0.,    0.,    0.,    0.,    1.],
         [ 656.,    0.,    0.,    0.,    0.,    0.,    0.,    0.],
         [-269.,    0.,    0.,    0.,    0.,    0.,    0.,    0.],
         [-269.,    0.,    0.,    0.,    0.,    0.,    0.,    0.],
         [ 549.,    0.,    0.,    0.,    0.,    0.,    0.,    0.],
         [ 595.,    0.,    0.,    0.,    0.,    0.,    0.,    0.],
         [ 453.,    0.,    0.,    0.,    0.,    0.,    0.,    0.],
         [ 600.,    0.,    0.,    0.,    0.,    0.,    0.,    0.],
         [ 839.,    0.,    0.,    0.,    0.,    0.,    0.,    0.],
         [-269.,    0.,    0.,    0.,    0.,    0.,    0.,    0.],
         [-269.,    0.,    0.,    0.,    0.,    0.,    0.,    0.]]])
</code></pre>
<p>Any idea on what I am doing wrong? I thought that it could be the way I am intializing my NN so I added the arguments name to the constructor but it doesnt seem to help.</p>
<p>Any suggestion is appreciated!</p>
<p>Kind regards</p>

ptrblck: <p>The <code>bidirectional</code> argument expect a <code>bool</code> value, while you are passing an <code>int</code> to it. Change it to <code>bidirectional=False</code> and it should work.</p>