From caa3371376abe7149c1ab1b8eb5bcfe02c91423c Mon Sep 17 00:00:00 2001 From: Christoph Lassner Date: Mon, 21 Dec 2020 13:00:47 -0800 Subject: [PATCH] Fix Pulsar backend batched radius handling. Summary: This fixes a corner case for multi-radius handling for the pulsar backend. The additional dimensionality check ensures that the batched parsing for radiuses is only performed when appropriate. Reviewed By: bottler Differential Revision: D25387708 fbshipit-source-id: c486dcf327f812265b7ca8ca5ef5c6a31e6d4549 --- pytorch3d/renderer/points/pulsar/unified.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pytorch3d/renderer/points/pulsar/unified.py b/pytorch3d/renderer/points/pulsar/unified.py index 06d27c79..56ea3407 100644 --- a/pytorch3d/renderer/points/pulsar/unified.py +++ b/pytorch3d/renderer/points/pulsar/unified.py @@ -399,7 +399,11 @@ class PulsarPointsRenderer(nn.Module): raster_rad = self.rasterizer.raster_settings.radius if kwargs.get("radius_world", False): return raster_rad - if isinstance(raster_rad, torch.Tensor) and raster_rad.numel() > 1: + if ( + isinstance(raster_rad, torch.Tensor) + and raster_rad.numel() > 1 + and raster_rad.ndim > 1 + ): # In this case it must be a batched torch tensor. raster_rad = raster_rad[cloud_idx] if orthogonal_projection: