I am doing something with LSTM
, and in each timestep, the input feature is 2-dim, when create lstm layer with lstm = torch.nn.LSTM((10, 20), 20, 1)
, I get errors.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\whq\Anaconda3\lib\site-packages\torch\nn\modules\rnn.py", line 372, in __init__
super(LSTM, self).__init__('LSTM', *args, **kwargs)
File "C:\Users\whq\Anaconda3\lib\site-packages\torch\nn\modules\rnn.py", line 39, in __init__
w_ih = Parameter(torch.Tensor(gate_size, layer_input_size))
TypeError: torch.FloatTensor constructor received an invalid combination of arguments - got (int, tuple), but expected one of:
* no arguments
* (int ...)
didn't match because some of the arguments have invalid types: (e[31;1minte[0m, e[31;1mtuplee[0m)
* (torch.FloatTensor viewed_tensor)
* (torch.Size size)
* (torch.FloatStorage data)
* (Sequence data)
So, dose LSTM
support 2D features, or I have to reshape input features to 1D?