michaelj commited on
Commit
c851a4b
·
verified ·
1 Parent(s): f1632a4

v_pos.to(level.device), t_pos_idx.to(level.device)

Browse files
Files changed (1) hide show
  1. tsr/models/isosurface.py +4 -4
tsr/models/isosurface.py CHANGED
@@ -7,7 +7,7 @@ from torchmcubes import marching_cubes
7
 
8
 
9
  class IsosurfaceHelper(nn.Module):
10
- points_range: Tuple[float, float] = (0, 1)
11
 
12
  @property
13
  def grid_vertices(self) -> torch.FloatTensor:
@@ -41,8 +41,8 @@ class MarchingCubeHelper(IsosurfaceHelper):
41
  self,
42
  level: torch.FloatTensor,
43
  ) -> Tuple[torch.FloatTensor, torch.LongTensor]:
44
- level = -level.view(self.resolution, self.resolution, self.resolution)
45
  v_pos, t_pos_idx = self.mc_func(level.detach(), 0.0)
46
  v_pos = v_pos[..., [2, 1, 0]]
47
- v_pos = v_pos / (self.resolution - 1.0)
48
- return v_pos, t_pos_idx
 
7
 
8
 
9
  class IsosurfaceHelper(nn.Module):
10
+ points_range: Tuple[float, float] = (-1, 1)
11
 
12
  @property
13
  def grid_vertices(self) -> torch.FloatTensor:
 
41
  self,
42
  level: torch.FloatTensor,
43
  ) -> Tuple[torch.FloatTensor, torch.LongTensor]:
44
+ level = level.view(self.resolution, self.resolution, self.resolution)
45
  v_pos, t_pos_idx = self.mc_func(level.detach(), 0.0)
46
  v_pos = v_pos[..., [2, 1, 0]]
47
+ v_pos = v_pos * 2.0 / (self.resolution - 1.0) - 1.0
48
+ return v_pos.to(level.device), t_pos_idx.to(level.device)