From a52263869d603baa2e502168408dd8c8c01d37c9 Mon Sep 17 00:00:00 2001 From: Arun Madhav Date: Wed, 5 Nov 2025 12:48:01 +0530 Subject: [PATCH] Fixed direct call of prune_points() issue In the original code self.tmp_radii is not declared in self.__init__() In train.py when densify_and_prune() is called it declares self.tmp_radii and sets self.tmp_radii to None once densification and pruning is done. Hence, if prune_points() in called it will throw error as attribute does not exist (or) if densify_and_prune() was called before it will throw error as we are accessing None. To rectify this and for better practice 1. Added self.tmp_radii = None to self.__init__() 2. Added condition to check if self.temp_radii is not None before accessing. --- scene/gaussian_model.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scene/gaussian_model.py b/scene/gaussian_model.py index 473887db89..909939322d 100644 --- a/scene/gaussian_model.py +++ b/scene/gaussian_model.py @@ -63,6 +63,7 @@ def __init__(self, sh_degree, optimizer_type="default"): self.optimizer = None self.percent_dense = 0 self.spatial_lr_scale = 0 + self.tmp_radii = None self.setup_functions() def capture(self): @@ -361,7 +362,9 @@ def prune_points(self, mask): self.denom = self.denom[valid_points_mask] self.max_radii2D = self.max_radii2D[valid_points_mask] - self.tmp_radii = self.tmp_radii[valid_points_mask] + + if self.tmp_radii is not None: + self.tmp_radii = self.tmp_radii[valid_points_mask] def cat_tensors_to_optimizer(self, tensors_dict): optimizable_tensors = {}