| from __future__ import annotations | |
| from typing import Any | |
| import torch | |
| def scene_encode_kwargs(batch: dict[str, Any], device: torch.device, model_uses_rgbd: bool) -> dict[str, Any]: | |
| kwargs: dict[str, Any] = {} | |
| if not model_uses_rgbd: | |
| return kwargs | |
| kwargs["depths"] = batch.get("depths").to(device) if batch.get("depths") is not None else None | |
| kwargs["depth_valid"] = batch.get("depth_valid").to(device) if batch.get("depth_valid") is not None else None | |
| kwargs["camera_intrinsics"] = batch.get("camera_intrinsics").to(device) if batch.get("camera_intrinsics") is not None else None | |
| kwargs["camera_extrinsics"] = batch.get("camera_extrinsics").to(device) if batch.get("camera_extrinsics") is not None else None | |
| return kwargs | |