oreilly-japan / deep-learning-from-scratch

『ゼロから作る Deep Learning』(O'Reilly Japan, 2016)
MIT License
4.04k stars 3.36k forks source link

Question about the algorithm of col2im #30

Closed nyngwang closed 6 years ago

nyngwang commented 6 years ago

Dear author/team, I'm your reader, I need help to confirm about some logic of the algorithm used in col2im, line 92 as follow

https://github.com/oreilly-japan/deep-learning-from-scratch/blob/ea91786b9f27df440000b6d46e534831fb780b80/common/util.py#L92

Is that the two additions of stride - 1 in both height and width of img just to prevent "index out of bound" error? I've tried some examples without it and haven't encountered any error, so I'm curious about at which case that error would happen. And I also found that col2im is not the inverse function of im2col when H + 2*pad - FH is divisible by stride.

Thank you!