rasbt / machine-learning-book

Code Repository for Machine Learning with PyTorch and Scikit-Learn
https://sebastianraschka.com/books/#machine-learning-with-pytorch-and-scikit-learn
MIT License
3.39k stars 1.24k forks source link

Fix stride in 1D and 2D convolution example #168

Closed JaGeo closed 6 months ago

JaGeo commented 6 months ago

The stride in the 2D convolution example was not implemented correctly. The for loops did not consider the stride which lead to issues when changing to another example including a stride different from (1,1).

review-notebook-app[bot] commented 6 months ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

JaGeo commented 6 months ago

Now, it is fixed. There was a multiplication with the stride itself missing as the loops give the indices in the corresponding padded matrices. In the very simple, stride=1 case, it worked correctly.

Likely also wrong in the 1D case. Have to check that more carefully as well.

JaGeo commented 6 months ago

Now, it should be fixed. Sorry for taking a bit longer with this in the pull request.

rasbt commented 6 months ago

Thanks so much for the kind update. This is awesome! I added a note & acknowledgement to the errata so I don't forget updating this in the book, too!