Exemple #1
0
def test_convolve1d_3():
    npr.seed(3)

    for ii in xrange(NUM_TRIALS):

        np_A = npr.randn(5, 50)
        np_B = npr.randn(6 * 5, 4)
        A = kayak.Parameter(np_A)
        B = kayak.Parameter(np_B)
        C = kayak.Convolve1d(A, B, ncolors=5)

        assert_equals(C.value.shape, (5, (10 - 6 + 1) * 4))
Exemple #2
0
def test_convolve1d_1():
    npr.seed(3)

    for ii in xrange(NUM_TRIALS):

        np_A = npr.randn(5, 6)
        np_B = npr.randn(6, 7)
        A = kayak.Parameter(np_A)
        B = kayak.Parameter(np_B)
        C = kayak.Convolve1d(A, B, ncolors=1)

        # If the filters are the same size as the data
        assert C.value.shape == (5, 7)
Exemple #3
0
def test_convolve1d_grad_1():
    npr.seed(3)

    for ii in xrange(NUM_TRIALS):

        np_A = npr.randn(5, 6)
        np_B = npr.randn(6, 7)
        A = kayak.Parameter(np_A)
        B = kayak.Parameter(np_B)
        C = kayak.Convolve1d(A, B)
        D = kayak.MatSum(C)

        D.value
        assert_equals(D.grad(A).shape, (5, 6))
        assert_equals(D.grad(B).shape, (6, 7))
        assert_less(kayak.util.checkgrad(A, D), MAX_GRAD_DIFF)
        assert_less(kayak.util.checkgrad(B, D), MAX_GRAD_DIFF)