def testPtpExecution(self): x = arange(4, chunk_size=1).reshape(2, 2) t = ptp(x, axis=0) res = self.executor.execute_tensor(t, concat=True)[0] expected = np.ptp(np.arange(4).reshape(2, 2), axis=0) np.testing.assert_equal(res, expected) t = ptp(x, axis=1) res = self.executor.execute_tensor(t, concat=True)[0] expected = np.ptp(np.arange(4).reshape(2, 2), axis=1) np.testing.assert_equal(res, expected) t = ptp(x) res = self.executor.execute_tensor(t)[0] expected = np.ptp(np.arange(4).reshape(2, 2)) np.testing.assert_equal(res, expected)
def test_ptp_execution(setup): x = arange(4, chunk_size=1).reshape(2, 2) t = ptp(x, axis=0) res = t.execute().fetch() expected = np.ptp(np.arange(4).reshape(2, 2), axis=0) np.testing.assert_equal(res, expected) t = ptp(x, axis=1) res = t.execute().fetch() expected = np.ptp(np.arange(4).reshape(2, 2), axis=1) np.testing.assert_equal(res, expected) t = ptp(x) res = t.execute().fetch() expected = np.ptp(np.arange(4).reshape(2, 2)) np.testing.assert_equal(res, expected)