You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
percentile fails or truncates results for integer and float16 tensors #9321
monai.transforms.utils_pytorch_numpy_unification.percentile fails or returns wrong values for non-float32/float64 inputs:
Integer and float16/bfloat16 tensors with at most 1e6 elements raise RuntimeError: quantile() input tensor must be either float or double dtype, because torch.quantile only accepts float32/float64.
On the numpy path (numpy inputs, and tensors above 1e6 elements, see pytorch#64947) the result is cast back to the input dtype, so interpolated percentiles of integer inputs are silently truncated.
As a consequence, ScaleIntensityRangePercentiles and ClipIntensityPercentiles (and their dict versions) fail on integer images such as uint8 PNGs or int16 CT volumes. Numpy inputs fail too, because these transforms convert to tensors first.
Activity