예제 #1
0
    def test_get_by_inds(self):
        # Nonempty index array:
        data = np.random.rand(3)
        pm = GPUPortMapper('/foo[0:3]', data)
        res = pm.get_by_inds(np.array([0, 1]))
        assert_array_equal(data[0:2], res)

        # Empty index array:
        res = pm.get_by_inds(np.array([], np.int_))
        assert len(res) == 0
예제 #2
0
 def test_get_by_inds(self):
     data = np.random.rand(3)
     pm = GPUPortMapper('/foo[0:3]', data)
     res = pm.get_by_inds(np.array([0, 1]))
     assert_array_equal(data[0:2], res)