Repository navigation
Convolution as equation 21.8 (kernel not flipped, same length) - #43
Merged
Merged
Conversation
The convolution flipped the kernel, as numpy, and a kernel longer than
the input gave the empty vector, as the valid convolution of Figure
21.4. It now computes z_i = sum_j k_j x_{j+i-(l+1)/2} with the zero
padding of Figure 21.5, one value for each input; for an even l the
kernel covers one element more to the right of x_i. The kernel [1, 1, 1]
on [1, 2] now gives [3, 3] instead of the empty vector.
convolve2D flipped the kernel, as scipy. It now follows the conventions of ConvLayer1D.convolve: the kernel [1, -1] on [[1, 2, 3], [4, 5, 6]] gives [[-1, -1, 3], [-1, -1, 6]] instead of [[1, 1, 1], [4, 1, 1]], an impulse gives the kernel rotated by 180 degrees, and the edge detectors respond at the last column before a step, so the tests look there.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ConvLayer1D.convolve and ImageProcessing.convolve2D now follow equation 21.8: the kernel is not flipped (footnote 4 of chapter 21), zero padding as in figure 21.5, output as long as the input also for a kernel longer than the input, and for an even kernel the extra element on the right (below, in 2-D), as the 'same' padding of Keras and PyTorch
expected values that change: