FS = np.asanyarray(map(lambda x, y: np.convolve(x, y, 'valid'), F, S))
firstzero = (FS[:, (0)] == 0).sum()
bothzero = (FS == 0).all(1).sum()
print('firstzero', firstzero)
print('bothzero', bothzero)
Как ускорить numpy-код