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

Method test

tests/pointersect/pr/test_naive.py:113–139  ·  view source on GitHub ↗
(
            self,
            b=10,
            m=7,
            n=20,
            max_grid_size=5,
            seed=1,
    )

Source from the content-addressed store, hash-verified

111 assert np.allclose(pidxs, pidxs_gt), f"[{b},{m}], {pidxs}, {pidxs_gt}"
112
113 def test(
114 self,
115 b=10,
116 m=7,
117 n=20,
118 max_grid_size=5,
119 seed=1,
120 ):
121 if seed is not None:
122 torch.manual_seed(seed)
123 random.seed(seed)
124 np.random.seed(seed)
125
126 points = torch.randn(b, n, 3)
127 ray_origins = torch.randn(b, m, 3)
128 ray_directions = torch.nn.functional.normalize(torch.randn(b, m, 3), dim=-1)
129 ray_radius = torch.rand(b) + 0.01
130 grid_size = (torch.rand(b, 3) * (max_grid_size - 1) + 1).long()
131
132 self._test(
133 points=points,
134 ray_origins=ray_origins,
135 ray_directions=ray_directions,
136 ray_radius=ray_radius,
137 grid_size=grid_size,
138 # include_outside=include_outside,
139 )
140
141 def test2(self):
142 max_b = 100

Callers 1

test2Method · 0.95

Calls 1

_testMethod · 0.95

Tested by

no test coverage detected