udacity / deep-learning-v2-pytorch

Projects and exercises for the latest Deep Learning ND program https://www.udacity.com/course/deep-learning-nanodegree--nd101
MIT License
5.26k stars 5.32k forks source link

Add drop_last to Sentiment_RNN_Solution.ipynb #398

Closed salehsargolzaee closed 2 years ago

salehsargolzaee commented 2 years ago

When I tried to change the batch_size in the notebook from 50 to 64, I encountered the following error:

RuntimeError: Expected hidden[0] size (2, 4, 256), got (2, 64, 256)

It's because we have 20000 training samples and 2500 validation and test samples. Previously there was no error since these numbers are divisible by 50, which is the original batch_size in the solution notebook. Still, when someone wants to experiment with other batch sizes that are not divisible, they will encounter the mentioned error. So I added drop_last to the notebook so students can experiment with other batch sizes and will not be surprised due to this error.