[Fix] convert camera_idx to tensor (#2890)

convert camera_idx to tensor
This commit is contained in:
Tobias Fischer authored and GitHub committed 2024-02-09 17:53:34 +02:00
1 parent 1d070f5625
commit efa91e5df7
1 file changed
+1 -1
+1 -1
View File
@@ -157,7 +157,7 @@ class CameraOptimizer(nn.Module):
assert camera.metadata is not None, "Must provide id of camera in its metadata"
assert "cam_idx" in camera.metadata, "Must provide id of camera in its metadata"
camera_idx = camera.metadata["cam_idx"]
adj = self([camera_idx]) # type: ignore
adj = self(torch.tensor([camera_idx], dtype=torch.long, device=camera.device)) # type: ignore
adj = torch.cat([adj, torch.Tensor([0, 0, 0, 1])[None, None].to(adj)], dim=1)
camera.camera_to_worlds = torch.bmm(camera.camera_to_worlds, adj)