Ejemplo n.º 1
0
def test_l1_matrix_colwise():
    inpt = T.matrix()
    norm = l1(inpt, axis=0)
    f = theano.function([inpt], norm, mode='FAST_COMPILE')
    res = f(test_matrix)
    correct = np.allclose(res, [3., 4.2, 6.5, 100.2])
    assert correct, 'l1 norm colwise not working'
Ejemplo n.º 2
0
def test_l1_matrix_rowwise():
    inpt = T.matrix()
    norm = l1(inpt, axis=1)
    f = theano.function([inpt], norm, mode='FAST_COMPILE')
    res = f(test_matrix)
    correct = np.allclose(res, [109.9, 4.])
    assert correct, 'l1 norm rowwise not working'
Ejemplo n.º 3
0
def test_l1_matrix():
    inpt = T.matrix()
    norm = l1(inpt)
    f = theano.function([inpt], norm, mode='FAST_COMPILE')
    assert np.allclose(f(test_matrix), 113.9), 'l1 norm for matrix not working'
Ejemplo n.º 4
0
def test_l1_vector():
    inpt = T.vector()
    norm = l1(inpt)
    f = theano.function([inpt], norm, mode='FAST_COMPILE')
    assert f(test_arr) == 4, 'l1 norm for vector not working'