Пример #1
0
    def testMedianExecution(self):
        raw = np.random.rand(20, 10)
        a = tensor(raw, chunk_size=7)
        r = median(a)

        result = self.executor.execute_tensor(r, concat=True)[0]
        expected = np.median(raw)

        np.testing.assert_array_equal(result, expected)

        r = median(a, axis=1)

        result = self.executor.execute_tensor(r, concat=True)[0]
        expected = np.median(raw, axis=1)

        np.testing.assert_array_equal(result, expected)
Пример #2
0
def test_median_execution(setup):
    raw = np.random.rand(20, 10)
    a = tensor(raw, chunk_size=7)
    r = median(a)

    result = r.execute().fetch()
    expected = np.median(raw)

    np.testing.assert_array_equal(result, expected)

    r = median(a, axis=1)

    result = r.execute().fetch()
    expected = np.median(raw, axis=1)

    np.testing.assert_array_equal(result, expected)