Beispiel #1
0
def test_extremes():
    tensor = DenseTensor(zeros(100,))
    for i in range(100):
        tensor[i] = i*10

    extremes = tensor.extremes()
    bottom, top = extremes[:10], extremes[10:]
    eq_(bottom, [((i,), i*10.) for i in range(10)])
    eq_(top, [((i,), i*10.) for i in range(90,100)])
Beispiel #2
0
def test_extremes():
    tensor = DenseTensor(zeros(100, ))
    for i in range(100):
        tensor[i] = i * 10

    extremes = tensor.extremes()
    bottom, top = extremes[:10], extremes[10:]
    eq_(bottom, [((i, ), i * 10.) for i in range(10)])
    eq_(top, [((i, ), i * 10.) for i in range(90, 100)])
Beispiel #3
0
def test_extreme_items():
    tensor = DenseTensor(zeros(100,))
    for i in range(100):
        tensor[i] = i*10

    extremes = tensor.extremes()
    top, bottom = tensor.extreme_items(10, 10)
    eq_(bottom, [((i,), i*10.) for i in range(10)])
    eq_(top, [((i,), i*10.) for i in range(90,100)])
Beispiel #4
0
def test_extreme_items():
    tensor = DenseTensor(zeros(100, ))
    for i in range(100):
        tensor[i] = i * 10

    extremes = tensor.extremes()
    top, bottom = tensor.extreme_items(10, 10)
    eq_(bottom, [((i, ), i * 10.) for i in range(10)])
    eq_(top, [((i, ), i * 10.) for i in range(90, 100)])