code: def test_duplicate_transforms(self):
      data = [
          {
              "img": create_test_image_2d(
                  128, 128, num_seg_classes=1, channel_dim=0
              )[0]
          }
          for _ in range(2)
      ]
  
      # at least 1 deterministic followed by at least 1 random
      transform = Compose(
          [Spacingd("img", pixdim=(1, 1)), RandAffined("img", prob=1.0)]
      )
  
      # cachedataset and data loader w persistent_workers
      train_ds = CacheDataset(data, transform, cache_num=1)
      # num_workers > 1 may fail randomly with 21.09 on A100 test node
      # https://github.com/Project-MONAI/MONAI/issues/3283
      train_loader = DataLoader(
          train_ds, num_workers=1, persistent_workers=True
      )
  
      b1 = next(iter(train_loader))
      b2 = next(iter(train_loader))
  
      self.assertEqual(
          len(b1["img"].applied_operations),
          len(b2["img"].applied_operations),
      )
  
imports: from __future__ import annotations
  import unittest
  from monai.data import CacheDataset, DataLoader, create_test_image_2d
  from monai.transforms import Compose, RandAffined, Spacingd
label_desc: Use image node_id 1 for calling the TestTransformsWCacheDatasetAndPersistentWorkers obj's underlying member method code with example usage: obj.test_duplicate_transforms() without return types