コード例 #1
0
def test_absolute():
    X, Y = T.matrix(), T.matrix()
    X.tag.test_value = test_X
    Y.tag.test_value = test_Y
    dist = absolute(X, Y).sum()
    f = theano.function([X, Y], dist, mode='FAST_COMPILE')
    res = f(test_X, test_Y)
    assert res == 0.21, 'absolute loss not working'
コード例 #2
0
ファイル: test_component_loss.py プロジェクト: makarl/breze
def test_absolute_colwise():
    X, Y = T.matrix(), T.matrix()
    X.tag.test_value = test_X
    Y.tag.test_value = test_Y
    dist = absolute(X, Y).sum(axis=0)
    f = theano.function([X, Y], dist, mode='FAST_COMPILE')
    res = f(test_X, test_Y)
    correct = np.allclose(res, [0.06, 0.08, 0.07])
    assert correct, 'absolute loss colwise not working'
コード例 #3
0
ファイル: test_component_loss.py プロジェクト: makarl/breze
def test_absolute():
    X, Y = T.matrix(), T.matrix()
    X.tag.test_value = test_X
    Y.tag.test_value = test_Y
    dist = absolute(X, Y).sum()
    f = theano.function([X, Y], dist, mode='FAST_COMPILE')
    res = f(test_X, test_Y)
    print res
    assert np.allclose(res, 0.21), 'absolute loss not working'
コード例 #4
0
def test_absolute_rowwise():
    X, Y = T.matrix(), T.matrix()
    X.tag.test_value = test_X
    Y.tag.test_value = test_Y
    dist = absolute(X, Y).sum(axis=1)
    f = theano.function([X, Y], dist, mode='FAST_COMPILE')
    res = f(test_X, test_Y)
    correct = roughly(res, [0.06, 0.15])
    assert correct, 'absolute loss rowwise not working'