Commit 49a1ae5
authored
Fix docs code for ScaleIntensityRangePercentiles (#6829)
When running the docs code for `ScaleIntensityRangePercentiles`, it
failed with the error (MONAI 1.2.dev2316):
```
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/mhadlich/anaconda3/envs/monai/lib/python3.8/site-packages/monai/transforms/intensity/array.py", line 998, in __call__
img_t = self._normalize(img=img_t)
File "/home/mhadlich/anaconda3/envs/monai/lib/python3.8/site-packages/monai/transforms/intensity/array.py", line 971, in _normalize
a_min: float = percentile(img, self.lower) # type: ignore
File "/home/mhadlich/anaconda3/envs/monai/lib/python3.8/site-packages/monai/transforms/utils_pytorch_numpy_unification.py", line 121, in percentile
result = torch.quantile(x, q, dim=dim, keepdim=keepdim)
RuntimeError: quantile() input tensor must be either float or double dtype
```
This commit updates the docs for the function to use `torch.Tensor`
instead.
### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [ ] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [x] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.
Signed-off-by: Matthias Hadlich <matthiashadlich@posteo.de>1 parent 5e6ce7c commit 49a1ae5
1 file changed
Lines changed: 14 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1132 | 1132 | | |
1133 | 1133 | | |
1134 | 1134 | | |
1135 | | - | |
| 1135 | + | |
1136 | 1136 | | |
1137 | 1137 | | |
1138 | 1138 | | |
| |||
1144 | 1144 | | |
1145 | 1145 | | |
1146 | 1146 | | |
1147 | | - | |
1148 | | - | |
1149 | | - | |
1150 | | - | |
1151 | | - | |
1152 | | - | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
1153 | 1154 | | |
1154 | 1155 | | |
1155 | 1156 | | |
1156 | 1157 | | |
1157 | 1158 | | |
1158 | | - | |
1159 | | - | |
1160 | | - | |
1161 | | - | |
1162 | | - | |
1163 | | - | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
1164 | 1165 | | |
1165 | 1166 | | |
1166 | 1167 | | |
| |||
0 commit comments