def test_chamfer_distance1(self, device, dtype, get_input, get_tol): p1, p2 = get_input output1 = pc.chamfer_distance(p1, p2) output2 = pc.chamfer_distance(p2, p1) expected1 = torch.tensor([72.5838, 151.0809], dtype=dtype, device=device) atol, rtol = get_tol assert torch.allclose(output1, expected1, atol=atol, rtol=rtol)
def test_chamfer_distance(self, device, dtype, p1, p2, tolerances): output = pc.chamfer_distance(p1, p2) expected = torch.tensor([72.5838, 151.0809], dtype=dtype, device=device) atol, rtol = tolerances assert torch.allclose(output, expected, atol=atol, rtol=rtol)
def test_chamfer_distance2(self, device, dtype, get_input, get_tol): p1, p2 = get_input output2 = pc.chamfer_distance(p1, p2, w1=1.3, w2=0.8) expected2 = torch.tensor([71.4303, 150.8620], dtype=dtype, device=device) atol, rtol = get_tol assert torch.allclose(output2, expected2, atol=atol, rtol=rtol)
def test_chamfer_distance_not_squared(self, device, dtype, p1, p2, tolerances): output = pc.chamfer_distance(p1, p2, squared=False) expected = torch.tensor([11.1704, 17.1130], dtype=dtype, device=device) atol, rtol = tolerances assert torch.allclose(output, expected, atol=atol, rtol=rtol)
def test_weighted_chamfer_distance(self, device, dtype, p1, p2, tolerances): output = pc.chamfer_distance(p1, p2, w1=1.3, w2=0.8) expected = torch.tensor([71.4303, 150.8620], dtype=dtype, device=device) atol, rtol = tolerances assert torch.allclose(output, expected, atol=atol, rtol=rtol)