Intel-inspired edge inference prototype is validating a small one-dimensional convolution before mapping it to an optimized kernel. You need to compute the valid convolution output for a single channel with stride 1. The operation is cross-correlation (the kernel is not flipped): out[i] = sum_j x[i+j]*k[j] over valid positions only.
Compute the 'valid' one-dimensional convolution of the signal x with the kernel k, without flipping the kernel (cross-correlation): out[i]=∑jx[i+j]k[j] for every position where the kernel fits entirely inside the signal.
Implement solve(x,k).
Returns. Return a float NumPy array of length len(x) - len(k) + 1 (empty if the kernel is longer than the signal).
Example 1
Input:
solve([1, 2, 3, 4], [1, 0, -1])
Output:
[-2.0, -2.0]
Example 2
Input:
solve([1.0, 1.0, 1.0], [2.0])
Output:
[2.0, 2.0, 2.0]
No results yet
Run your code to check it against the examples, or submit to run every test.