![]() # The prediction utilizing the whole sequence is the last one Out = out.view(x_batches, x_seqs, x_seq_len, -1) Then I proceeded to overwrite the forward function: def forward(self, x): Input_size=x_features, # 45, see the data definition The most simple way to implement an LSTM coupled with a Linear layer I came up with is this: class MockupModel(nn.Module): I’ll however lay out the data first so that the transformations make sense to you: # A batch is in shape Let me thus share a mockup solution that utilizes torch.nn.ModuleDict and a custom forward function. I too tried to tackle my problem first by using the nn.Sequential container, but the problem lies in that the nn.LSTM outputs a tuple. Hi been tackling a similar problem as you have in this post. This is a relatively open-ended question, so I appreciate your time in advance! Test_loader = data_utils.DataLoader(test_dataset, batch_size=1, shuffle=True) Test_dataset = data_utils.TensorDataset(test_x_data, test_y_data) What is the correct way to use DataLoader in conjunction with an LSTM network? I’m using the default DataLoader, which doesn’t seem to play way with nn.LSTM:.Why is the data to an LSTM network different from that to a Linear one? What is the significance of the outer most dimension?.How can I use an LSTM network as part of a Sequential container?.However, simply getting it to work concerns me because I feel like I’m using the nn incorrectly. I was able to work around it by splitting my Sequential nn container into two layer, as well as reshaping my input/output to/from the LSTM layer like so: layerA = torch.nn.LSTM(D_in, H) The input can also be a packed variable length sequence Input of shape (seq_len, batch, input_size): tensor containing the features of the input sequence. I found that the input expected by an LSTM network is a bit different than a Linear transformation: RuntimeError: input must have 3 dimensions, got 2 I wanted to use an LSTM network, so I tried to do the following: model = torch.nn.Sequential( Working through one of the tutorials, I built a NN made up of the following components: model = torch.nn.Sequential( I’ll start off by saying that I know very little about deep learning but still wanted to try and apply it to some of the work I’ve been doing.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |