@@ -132,15 +132,13 @@ def _get_splat_kernel_normalization(
132132
133133 epsilon = 0.05
134134 normalization_constant = torch .exp (
135- # pyre-fixme[58]: `**` is not supported for operand types `Tensor` and `int`.
136- - (offsets ** 2 ).sum (dim = 1 ) / (2 * sigma ** 2 )
135+ - torch .square (offsets ).sum (dim = 1 ) / (2 * sigma ** 2 )
137136 ).sum ()
138137
139138 # We add an epsilon to the normalization constant to ensure the gradient will travel
140139 # through non-boundary pixels' normalization factor, see Sec. 3.3.1 in "Differentia-
141140 # ble Surface Rendering via Non-Differentiable Sampling", Cole et al.
142- # pyre-fixme[58]: `/` is not supported for operand types `float` and `Tensor`.
143- return (1 + epsilon ) / normalization_constant
141+ return torch .div (1 + epsilon , normalization_constant )
144142
145143
146144def _compute_occlusion_layers (
@@ -264,8 +262,9 @@ def _compute_splatting_colors_and_weights(
264262 torch .floor (pixel_coords_screen [..., :2 ]) - pixel_coords_screen [..., :2 ] + 0.5
265263 ).view ((N , H , W , K , 1 , 2 ))
266264
267- # pyre-fixme[58]: `**` is not supported for operand types `Tensor` and `int`.
268- dist2_p_q = torch .sum ((q_to_px_center + offsets ) ** 2 , dim = 5 ) # (N, H, W, K, 9)
265+ dist2_p_q = torch .sum (
266+ torch .square (q_to_px_center + offsets ), dim = 5
267+ ) # (N, H, W, K, 9)
269268 splat_weights = torch .exp (- dist2_p_q / (2 * sigma ** 2 ))
270269 alpha = colors [..., 3 :4 ]
271270 splat_weights = (alpha * splat_kernel_normalization * splat_weights ).unsqueeze (
@@ -417,12 +416,12 @@ def _normalize_and_compose_all_layers(
417416 device = splatted_colors_per_occlusion_layer .device
418417
419418 # Normalize each of bg/surface/fg splat layers separately.
420- normalization_scales = 1.0 / (
421- # pyre-fixme[58]: `/` is not supported for operand types `float` and `Tensor`.
419+ normalization_scales = torch . div (
420+ 1.0 ,
422421 torch .maximum (
423422 splatted_weights_per_occlusion_layer ,
424423 torch .tensor ([1.0 ], device = device ),
425- )
424+ ),
426425 ) # (N, H, W, 1, 3)
427426
428427 normalized_splatted_colors = (
0 commit comments