lkulowski / LSTM_encoder_decoder

Build a LSTM encoder-decoder using PyTorch to make sequence-to-sequence prediction for time series data
MIT License
366 stars 84 forks source link

Selecting Data for Batches #11

Open golnooshAbd opened 4 months ago

golnooshAbd commented 4 months ago

https://github.com/lkulowski/LSTM_encoder_decoder/blob/79a6ecef04f1fa6b152ffdd16c903fb5a284478b/code/lstm_encoder_decoder.py#L160

https://github.com/lkulowski/LSTM_encoder_decoder/blob/79a6ecef04f1fa6b152ffdd16c903fb5a284478b/code/lstm_encoder_decoder.py#L161

Basically these lines are wrong and should be changed like below to iterate on all samples, although, it still doesn't consider the last samples which are not fit into (less than) one batch.

input_batch = input_tensor[:, b * batch_size: (b + 1) * batch_size, :]
target_batch = target_tensor[:, b * batch_size: (b + 1) * batch_size, :]