Skip to content

Commit 2b3c74a

Browse files
tobiasfshrArpegorPSGH
authored andcommitted
[Fix] convert camera_idx to tensor (nerfstudio-project#2890)
convert camera_idx to tensor
1 parent 453b4ce commit 2b3c74a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

nerfstudio/cameras/camera_optimizers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def apply_to_camera(self, camera: Cameras) -> None:
157157
assert camera.metadata is not None, "Must provide id of camera in its metadata"
158158
assert "cam_idx" in camera.metadata, "Must provide id of camera in its metadata"
159159
camera_idx = camera.metadata["cam_idx"]
160-
adj = self([camera_idx]) # type: ignore
160+
adj = self(torch.tensor([camera_idx], dtype=torch.long, device=camera.device)) # type: ignore
161161
adj = torch.cat([adj, torch.Tensor([0, 0, 0, 1])[None, None].to(adj)], dim=1)
162162
camera.camera_to_worlds = torch.bmm(camera.camera_to_worlds, adj)
163163

0 commit comments

Comments
 (0)