MCPcopy Index your code
hub / github.com/apple/ml-pointersect / test_cpp

Method test_cpp

tests/pointersect/pr/test_pr_utils.py:222–250  ·  view source on GitHub ↗
(
            self,
            b=1,
            m=1,
            n=100000,
            max_grid_width=20.,
            max_ray_radius=1.,
            max_grid_size=100,
            seed=1,
    )

Source from the content-addressed store, hash-verified

220 print(f'cuda memory allocated: {torch.cuda.memory_allocated(0) / 1.e6} MB')
221
222 def test_cpp(
223 self,
224 b=1,
225 m=1,
226 n=100000,
227 max_grid_width=20.,
228 max_ray_radius=1.,
229 max_grid_size=100,
230 seed=1,
231 ):
232 if seed is not None:
233 torch.manual_seed(seed)
234 random.seed(seed)
235 np.random.seed(seed)
236
237 points = torch.rand(b, n, 3) * max_grid_width - max_grid_width / 2
238 ray_origins = torch.randn(b, m, 3)
239 ray_directions = torch.nn.functional.normalize(torch.randn(b, m, 3), dim=-1)
240 ray_radius = torch.rand(b) * (max_ray_radius - 0.00001) + 0.00001
241 grid_size = (torch.rand(b, 3) * (max_grid_size - 1) + 1).long()
242
243 self._test(
244 type='cpp',
245 points=points,
246 ray_origins=ray_origins,
247 ray_directions=ray_directions,
248 ray_radius=ray_radius,
249 grid_size=grid_size,
250 )
251
252 # problem: when m=n=10000, some result will not match
253 # max_grid_width=20.,

Callers

nothing calls this directly

Calls 1

_testMethod · 0.95

Tested by

no test coverage detected