Closed
Description
🐛 Bugs / Unexpected behaviors
Hi,
the function cameras_from_opencv_projection
instantiates cameras on the CPU side when provided with GPU tensors.
I believe that passing an additional parameter device=R.device
to the following constructor should solve the issue:
Best,
Romain
Instructions To Reproduce the Issue:
import torch
import pytorch3d.utils
device = torch.device(0)
R = torch.eye(3, device=device)[None]
tvec = torch.zeros(1, 3, device=device)
camera_matrix = torch.eye(3, device=device)[None]
image_size = torch.as_tensor([[320, 240]], device=device)
cameras = pytorch3d.utils.cameras_from_opencv_projection(R=R, tvec=tvec, camera_matrix=camera_matrix, image_size=image_size)
print("Input device", R.device)
print("Output device", cameras.R.device)
Output:
Input device cuda:0
Output device cpu
(expected output: cuda:0)
Metadata
Metadata
Assignees
Labels
No labels