Description:
I encountered a memory leakage issue when using a large dataset for long-term forecasting. It seems the problem occurred because the loss was being accumulated as a tensor instead of a scalar.
Solution:
To fix this, I changed:
loss_val += loss to loss_val += loss.item()
at the following lines: