Compute the single-channel valid 2-D convolution of an image X with a kernel K, as deep-learning libraries do: slide the kernel over the image without flipping it (technically cross-correlation) and sum the element-wise products at each position. No padding, stride 1.
Implement solve(X,K).
Returns. Return a float array of shape (H - kh + 1, W - kw + 1).
Example 1
Input:
solve([[1, 2], [3, 4]], [[1, 0], [0, 1]])
Output:
[[5.0]]
Example 2
Input:
solve([[1, 2, 3], [4, 5, 6], [7, 8, 9]], [[1, 0], [0, -1]])
Output:
[[-4.0, -4.0], [-4.0, -4.0]]
No results yet
Run your code to check it against the examples, or submit to run every test.