Skip to content

Commit

Permalink
fixed non contiguous error when using lstm_layers > 1 on gpu (#740)
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisbader committed Jan 15, 2022
1 parent adde52a commit ddc84a2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions darts/models/forecasting/tft_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,11 +482,15 @@ def forward(self, x) -> Dict[str, torch.Tensor]:

# LSTM
# calculate initial state
input_hidden = self.static_context_hidden_encoder_grn(static_embedding).expand(
self.lstm_layers, -1, -1
input_hidden = (
self.static_context_hidden_encoder_grn(static_embedding)
.expand(self.lstm_layers, -1, -1)
.contiguous()
)
input_cell = self.static_context_cell_encoder_grn(static_embedding).expand(
self.lstm_layers, -1, -1
input_cell = (
self.static_context_cell_encoder_grn(static_embedding)
.expand(self.lstm_layers, -1, -1)
.contiguous()
)

# run local lstm encoder
Expand Down

0 comments on commit ddc84a2

Please sign in to comment.