Skip to content

Commit

Permalink
move down the line transferring the gaussian_importance_map to device…
Browse files Browse the repository at this point in the history
… as this may cause results to be different
  • Loading branch information
FabianIsensee committed Apr 11, 2024
1 parent ec7087d commit 22945aa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion nnunetv2/inference/sliding_window_prediction.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ def compute_gaussian(tile_size: Union[Tuple[int, ...], List[int]], sigma_scale:
gaussian_importance_map = gaussian_filter(tmp, sigmas, 0, mode='constant', cval=0)

gaussian_importance_map = torch.from_numpy(gaussian_importance_map)
gaussian_importance_map = gaussian_importance_map.to(device=device, dtype=dtype)

gaussian_importance_map /= (torch.max(gaussian_importance_map) / value_scaling_factor)
gaussian_importance_map = gaussian_importance_map.to(device=device, dtype=dtype)
# gaussian_importance_map cannot be 0, otherwise we may end up with nans!
mask = gaussian_importance_map == 0
gaussian_importance_map[mask] = torch.min(gaussian_importance_map[~mask])
Expand Down

0 comments on commit 22945aa

Please sign in to comment.