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)))
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)
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)
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=' ')
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])
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)