xrg commited on
Commit
4a77b25
·
1 Parent(s): b7b3119

fix device bug

Browse files
Files changed (2) hide show
  1. app.py +1 -1
  2. core/models.py +1 -1
app.py CHANGED
@@ -87,7 +87,7 @@ model = model.half().to(device)
87
  model.eval()
88
 
89
  tan_half_fov = np.tan(0.5 * np.deg2rad(opt.fovy))
90
- proj_matrix = torch.zeros(4, 4, dtype=torch.float32, device=device)
91
  proj_matrix[0, 0] = 1 / tan_half_fov
92
  proj_matrix[1, 1] = 1 / tan_half_fov
93
  proj_matrix[2, 2] = (opt.zfar + opt.znear) / (opt.zfar - opt.znear)
 
87
  model.eval()
88
 
89
  tan_half_fov = np.tan(0.5 * np.deg2rad(opt.fovy))
90
+ proj_matrix = torch.zeros(4, 4, dtype=torch.float32).to(device)
91
  proj_matrix[0, 0] = 1 / tan_half_fov
92
  proj_matrix[1, 1] = 1 / tan_half_fov
93
  proj_matrix[2, 2] = (opt.zfar + opt.znear) / (opt.zfar - opt.znear)
core/models.py CHANGED
@@ -134,7 +134,7 @@ class LTRFM_NeRF(nn.Module):
134
 
135
  if not use_texture_map:
136
  # query vertex colors
137
- vertices_tensor = torch.tensor(vertices, dtype=torch.float32, device=device).unsqueeze(0)
138
  rgb_colors = self.tensorRF.predict_color(
139
  planes, vertices_tensor)['rgb'].squeeze(0).cpu().numpy()
140
  rgb_colors = (rgb_colors * 255).astype(np.uint8)
 
134
 
135
  if not use_texture_map:
136
  # query vertex colors
137
+ vertices_tensor = torch.tensor(vertices, dtype=torch.float32).to(device).unsqueeze(0)
138
  rgb_colors = self.tensorRF.predict_color(
139
  planes, vertices_tensor)['rgb'].squeeze(0).cpu().numpy()
140
  rgb_colors = (rgb_colors * 255).astype(np.uint8)