Skip to content

Commit e1552eb

Browse files
committed
update TTA transform validation and warning formatting
Signed-off-by: ytl0623 <david89062388@gmail.com>
1 parent 441c7af commit e1552eb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

monai/data/test_time_augmentation.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class TestTimeAugmentation:
6767
Args:
6868
transform: transform (or composed) to be applied to each realization. At least one transform must be of type
6969
`RandomizableTrait` (i.e. `Randomizable`, `RandomizableTransform`, or `RandomizableTrait`).
70-
All random transforms must be of type `InvertibleTransform`.
70+
When `apply_inverse_to_pred` is True, all random transforms must be of type `InvertibleTransform`.
7171
batch_size: number of realizations to infer at once.
7272
num_workers: how many subprocesses to use for data.
7373
inferrer_fn: function to use to perform inference.
@@ -172,7 +172,10 @@ def _check_transforms(self):
172172
warns.append("TTA usually requires at least one `Randomizable` transform in the given transform sequence.")
173173

174174
if len(warns) > 0:
175-
warnings.warn("TTA has encountered issues with the given transforms:" + "\n ".join(warns))
175+
warnings.warn(
176+
"TTA has encountered issues with the given transforms:\n " + "\n ".join(warns),
177+
stacklevel=2,
178+
)
176179

177180
def __call__(
178181
self, data: dict[str, Any], num_examples: int = 10

0 commit comments

Comments
 (0)