MCPcopy Create free account
hub / github.com/apple/ml-pointersect / test_2

Method test_2

tests/plib/test_utils.py:27–41  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

25
26
27 def test_2(self):
28 N = 10000
29 stime = timer()
30 for _ in range(N):
31 out_dict = utils.ray_aabb_intersection_2(
32 ray_origin=torch.zeros(3),
33 ray_direction=torch.tensor([0,0,1.]),
34 bbox_min_bounds=torch.tensor([0,0,2.]),
35 bbox_max_bounds=torch.tensor([10, 10, 10.]),
36 )
37 etime = timer()
38 print(f'v2 takes {(etime - stime) / N} secs per test')
39 assert out_dict['is_intersected']
40 assert np.isclose(out_dict['t_near'].detach().cpu().numpy(), 2.)
41 assert np.isclose(out_dict['t_far'].detach().cpu().numpy(), 10.)
42
43 def test_3(self):
44 N = 10000

Callers

nothing calls this directly

Calls 1

detachMethod · 0.45

Tested by

no test coverage detected