def dotProdsWithAllWindows(x, X):
"""Slide x along the columns of X and compute the dot product
>>> x = np.array([[1, 1], [2, 2]])
>>> X = np.arange(12).reshape((2, -1))
>>> dotProdsWithAllWindows(x, X) # doctest: +NORMALIZE_WHITESPACE
array([27, 33, 39, 45, 51])
"""
return sig.correlate2d(X, x, mode='valid').flatten()
评论列表
文章目录