Hi, so I want to detect anomal peaks in ECG signal using 1d convolution by sliding normal looking ECG peak across the signal. Here is function that I’m using.

```
def convolve(signal, filt, stride):
signalt = torch.from_numpy(signal).float().view(1,1,-1)
filt = torch.from_numpy(filt).view(1,1,-1)
output = F.conv1d(input=signalt, weight=filt, stride=stride, padding=0)
return output.numpy().ravel()
```

The output I get is an ecg signal that has reduced anomaly peaks - I want to know which one those are so I was trying to get the difference between the original and the output, however the length does not match.

```
ef explain_anomalies(y, fil, stride, sigma=1.0):
avg = convolve(y, fil, stride).tolist()
residual = y - avg
# Calculate the variation in the distribution of the residual
std = np.std(residual)
return {'standard_deviation': round(std, 3),
'anomalies_dict': collections.OrderedDict([(index, y_i) for
index, y_i, avg_i in zip(count(), y, avg)
if (y_i > avg_i + (sigma*std)) | (y_i < avg_i - (sigma*std))])}
```

after calling explain_anomalies(ecg[‘signal’], sig_filt, stride=1)

where sig_filt is normal QRS peak that I want to do convolution with I get

```
<ipython-input-115-71fe810b0625> in explain_anomalies(y, fil, stride, sigma)
25
26 avg = convolve(y, fil, stride).tolist()
---> 27 residual = y - avg
28 # Calculate the variation in the distribution of the residual
29 std = np.std(residual)
ValueError: operands could not be broadcast together with shapes (71006,) (70977,)
```

Why does convolution reduce the numer of samples even though I have stride set to 1?