Understanding stride and filter size

Hello,

I am confused on how stride and filter size interact. Is the output of a convolution layer the largest tensor such that the filter can fit completely within the input?

Ex, consider A = [0,1,2,3,4,5,6,] and L = conv1d(1,1,3, stride=2)

What will the size of L(A) be?

Will the filter stop at 4 since applying it starting at A[7] will result in the filter going out of bounds?

So the dimension of your output will be 3?

From the function of definition for nn.conv1d

torch.nn.Conv1d(in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True, padding_mode='zeros')

C_in = 1,
C_out = 1,
K = 3
S = 1
P = 0

From the slide 63 of lecture 5, cs231n, the size of the L(A) : 1 X 5 X 1

So, the filter stops cross correlation at A[5] ie. 4 because of it goes out of bounds in the next stride.

1 Like

thanks, so the convolution operation continues to slide until it can no longer be completed within the tensor?