render nvs rgb and depth given ray conditions only
(self, info={}, ray_conditions: torch.Tensor = None, chunksize: int = 50)
| 207 | |
| 208 | |
| 209 | def render(self, info={}, ray_conditions: torch.Tensor = None, chunksize: int = 50): |
| 210 | """ |
| 211 | render nvs rgb and depth given ray conditions only |
| 212 | """ |
| 213 | B, S_target, C, H, W = ray_conditions.shape |
| 214 | NVS_prediction_list = [] |
| 215 | NVS_prediction_conf_list = [] |
| 216 | for cur_idx in range(0, S_target, chunksize): |
| 217 | end_idx = min(cur_idx + chunksize, S_target) |
| 218 | cur_ray_conditions = ray_conditions[:, cur_idx:end_idx, :, :, :] |
| 219 | aggregated_tokens_list, patch_start_idx, state_list = self.aggregator.render(ray_conditions=cur_ray_conditions, info=info) |
| 220 | |
| 221 | predictions = {} |
| 222 | with torch.amp.autocast(device_type='cuda', enabled=False): |
| 223 | # Create dummy images tensor with correct shape for target views |
| 224 | nvs_dummy_images = torch.zeros(B, end_idx - cur_idx, C, H, W, dtype=ray_conditions.dtype, device=ray_conditions.device) |
| 225 | nvs, nvs_conf = self.nvs_head( |
| 226 | aggregated_tokens_list, images=nvs_dummy_images, patch_start_idx=patch_start_idx |
| 227 | ) |
| 228 | NVS_prediction_list.append(nvs) |
| 229 | NVS_prediction_conf_list.append(nvs_conf) |
| 230 | predictions["nvs_pred"] = torch.cat(NVS_prediction_list, dim=1) |
| 231 | predictions["nvs_depth_conf"] = torch.cat(NVS_prediction_conf_list, dim=1) |
| 232 | |
| 233 | return predictions |
nothing calls this directly
no outgoing calls
no test coverage detected