示例#1
0
def test_exp_matrix_rowwise():
    inpt = T.matrix()
    norm = exp(inpt, axis=1)
    f = theano.function([inpt], norm, mode='FAST_COMPILE')
    res = f(test_matrix)
    correct = np.allclose(res, [114.68499678, 11.47521737])
    assert correct, 'exp norm rowwise not working'
示例#2
0
def test_exp_matrix_colwise():
    inpt = T.matrix()
    norm = exp(inpt, axis=0)
    f = theano.function([inpt], norm, mode='FAST_COMPILE')
    res = f(test_matrix)
    correct = np.allclose(res, [2.85361711, 24.90040964, 97.4061874, 1.])
    assert correct, 'exp norm colwise not working'
示例#3
0
def test_exp_matrix():
    inpt = T.matrix()
    norm = exp(inpt)
    f = theano.function([inpt], norm, mode='FAST_COMPILE')
    assert np.allclose(f(test_matrix), 126.16021414942891), 'exp norm for matrix not working'
示例#4
0
def test_exp_vector():
    inpt = T.vector()
    norm = exp(inpt)
    f = theano.function([inpt], norm, mode='FAST_COMPILE')
    assert np.allclose(f(test_arr), 11.475217368561138), 'exp norm for vector not working'