miriamkw/GluPredKit

Bugfix - LSTM shape error

Closed this issue · 2 comments

when I run calculate_metrics on the config 1 LSTM models, I get a shape error (Input 0 of layer "model" is incompatible with the layer: expected shape=(None, 24, 27), found shape=(None, 12, 1)).

No matter what it comes from, give a more descriptive error message.

Copy from duplicate issue:

The forward method in lstm pytorch should not be squeesed. this leads to the error: UserWarning: Using a target size (torch.Size([1])) that is different to the input size (torch.Size([])). This will likely lead to incorrect results due to broadcasting. Please ensure they have the same size.

The fix is to add: .squeeze(1), specifying the output format.