示例#1
0
 def test_two_spheres(self, init_res, upsampling_steps):
     final_res = init_res * 2**upsampling_steps + 1
     assert (torch.equal(
         sdf.sdf_to_voxelgrids([self.two_spheres],
                               init_res=init_res,
                               upsampling_steps=upsampling_steps),
         self.sdf_to_voxelgrids_naive([self.two_spheres], final_res)))
示例#2
0
 def test_upsampling_steps_type(self):
     with pytest.raises(TypeError,
                        match=r"Expected upsampling_steps to be int "
                        r"but got <class 'float'>."):
         sdf.sdf_to_voxelgrids([self.sphere], upsampling_steps=0.5)
示例#3
0
 def test_init_res_type(self):
     with pytest.raises(TypeError,
                        match=r"Expected init_res to be int "
                        r"but got <class 'float'>."):
         sdf.sdf_to_voxelgrids([self.sphere], init_res=0.5)
示例#4
0
 def test_bbox_dim_type(self):
     with pytest.raises(TypeError,
                        match=r"Expected bbox_dim to be int or float "
                        r"but got <class 'str'>."):
         sdf.sdf_to_voxelgrids([self.sphere], bbox_dim=' ')
示例#5
0
 def test_each_sdf_type(self):
     with pytest.raises(TypeError,
                        match=r"Expected sdf\[0\] to be callable "
                        r"but got <class 'int'>."):
         sdf.sdf_to_voxelgrids([0])
示例#6
0
 def test_sdf_type(self):
     with pytest.raises(TypeError,
                        match=r"Expected sdf to be list "
                        r"but got <class 'int'>."):
         sdf.sdf_to_voxelgrids(0)