コード例 #1
0
def test_potential_function_zeros():
    dists = np.zeros(10)
    value = BaseProbabilistic.potential_func(dists)
    assert np.array_equal(value, np.ones(10))
コード例 #2
0
def test_potential_function():
    dists = np.array([1.0, 0.5, 2, 0.33])
    value = BaseProbabilistic.potential_func(dists)
    assert np.allclose(value, [0.3679, 0.7788, 0.0183, 0.8968], atol=0.001)
コード例 #3
0
def test_potential_function_batch():
    dists = np.tile([1.0, 0.5, 2, 0.33], (10, 1))
    value = BaseProbabilistic.potential_func(dists)
    expected = np.tile([0.3679, 0.7788, 0.0183, 0.8968], (10, 1))
    assert np.allclose(value, expected, atol=0.001)