1111
1212from __future__ import annotations
1313
14- from itertools import product
1514import unittest
15+ from itertools import product
1616
1717import torch
1818from parameterized import parameterized
1919
20- from monai .data import MetaTensor , create_test_image_2d , Dataset , ThreadDataLoader , DataLoader
20+ from monai .data import DataLoader , Dataset , MetaTensor , ThreadDataLoader , create_test_image_2d
2121from monai .engines .evaluator import SupervisedEvaluator
2222from monai .transforms import Compose , EnsureChannelFirstd , Invertd , Spacingd
2323from monai .transforms .utility .dictionary import Lambdad
2424from monai .utils .enums import CommonKeys
25-
2625from tests .test_utils import TEST_DEVICES
2726
2827
@@ -48,12 +47,12 @@ def setUp(self):
4847 @parameterized .expand (TEST_DEVICES )
4948 def test_simple_processing (self , device ):
5049 """
51- Tests postprocessing operations perform correctly, in particular that `Invertd` does inversion correctly.
52-
53- This will apply the preprocessing sequence which resizes the result, then the postprocess sequence which
54- returns it to the original shape using Invertd. This tests that the shape of the output is the same as the
55- original image. This will also test that Invertd doesn't get confused if transforms in the postprocessing
56- sequence are tracing and so adding information to `applied_operations`, this is what `Lambdad` is doing in
50+ Tests postprocessing operations perform correctly, in particular that `Invertd` does inversion correctly.
51+
52+ This will apply the preprocessing sequence which resizes the result, then the postprocess sequence which
53+ returns it to the original shape using Invertd. This tests that the shape of the output is the same as the
54+ original image. This will also test that Invertd doesn't get confused if transforms in the postprocessing
55+ sequence are tracing and so adding information to `applied_operations`, this is what `Lambdad` is doing in
5756 `self.postprocessing`.
5857 """
5958
@@ -77,8 +76,8 @@ def test_simple_processing(self, device):
7776 @parameterized .expand (product (sum (TEST_DEVICES , []), [True , False ]))
7877 def test_workflow (self , device , use_threads ):
7978 """
80- This tests the interaction between pre and postprocesing transform sequences being executed in parallel.
81-
79+ This tests the interaction between pre and postprocesing transform sequences being executed in parallel.
80+
8281 When the `ThreadDataLoader` is used to load batches, this is done in parallel at times with the execution of
8382 the post-process transform sequence. Previously this encountered a race condition at times because the
8483 `TraceableTransform.tracing` variables of transforms was being toggled in different threads, so at times a
0 commit comments