def test_direct_center(self): c = np.array([1, 0, 1, 0, 0, 0]) d = np.array([1, 0, 0, 0, 1, 0]) predict_cd = np.array([2, 0, 1, 0, 1, 0]) np.testing.assert_allclose(convolve_direct(c, d), predict_cd)
def test_direct_backward(self): d = np.array([1, 0, 0, 0, 1, 0]) predict_dd = np.array([1, 0, 1, 0, 2, 0]) np.testing.assert_allclose(convolve_direct(d, d), predict_dd)
def test_direct_ID2(self): a = np.array([1, 0, 0, 0, 0, 0]) c = np.array([1, 0, 1, 0, 0, 0]) predict_ac = np.array([1, 0, 1, 0, 0, 0]) np.testing.assert_allclose(convolve_direct(a, c), predict_ac)
def test_direct_forward(self): c = np.array([1, 0, 1, 0, 0, 0]) predict_cc = np.array([1, 0, 2, 0, 1, 0]) np.testing.assert_allclose(convolve_direct(c, c), predict_cc)
def test_direct_ID(self): a = np.array([1, 0, 0, 0, 0, 0]) b = np.array([1, 0, 0, 0, 0, 0]) predict_ab = np.array([1, 0, 0, 0, 0, 0]) np.testing.assert_allclose(convolve_direct(a, b), predict_ab)