We can't find the internet
Attempting to reconnect
Something went wrong!
Attempting to reconnect
← CNNs from Scratch step 1 of 15
Hard
Primitives
Implement 1D Convolution
Implement a 1D convolution (cross-correlation) operation.
$$(x * w)[i] = \sum_{k=0}^{K-1} x[i + k] \cdot w[k] + b$$
Input:
-
x: 1D input tensor of shape(L,) -
weight: 1D kernel of shape(K,) -
bias: scalar bias -
stride: convolution stride (default 1)
Output: 1D tensor of shape (L_out,) where $L_{out} = \lfloor \frac{L - K}{\text{stride}} \rfloor + 1$
Loading visualization…
Nothing accepted yet. When a submission passes, the code that passed shows up
here, one entry per mode.
Stuck?
PyTorch reference solution
Sign in to attempt this problem and reveal the reference solution.