Implement the forward pass of a 1-D convolution layer (strictly speaking a cross-correlation, like every deep-learning framework uses).
conv1d(x, w, b, stride=1, padding=0)
x: input of shape (C_in, L)w: kernels of shape (C_out, C_in, K)b: bias of shape (C_out,)x with padding zeros, then slide each kernel with the given stride.Output shape is (C_out, L_out) with
Example
conv1d(np.array([[1., 2., 3., 4.]]), np.array([[[1., 0., -1.]]]), np.array([0.]))
# array([[-2., -2.]])