Skip to content

Ensure all tensors in GaussianRasterizer's raster_settings are on the same device #65

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions diff_gaussian_rasterization/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,15 @@ class GaussianRasterizer(nn.Module):
def __init__(self, raster_settings):
super().__init__()
self.raster_settings = raster_settings
self._sanitizeSettings()

def _sanitizeSettings(self):
# Check if all tensors in raster_settings is on same device
compute_devices = [_x.device for _x in self.raster_settings if isinstance(_x, torch.Tensor)]
if len(set(compute_devices)) > 1:
raise Exception('All tensors in raster_settings should be on the same device.')
if any([d == torch.device('cpu') for d in compute_devices]):
raise Exception('CUDA device is required for the rasterizer.')

def markVisible(self, positions):
# Mark visible points (based on frustum culling for camera) with a boolean
Expand Down