class_docstr: Basic Inference Task Helper
class_docstr_tok: ["Basic","Inference","Task","Helper"]
code: def run_pre_transforms(self, data: Dict[str, Any], transforms):
      pre_cache: List[Any] = []
      post_cache: List[Any] = []
  
      current = pre_cache
      cache_t = None
      for t in transforms:
          if isinstance(t, CacheTransformDatad):
              cache_t = t
              current = post_cache
          else:
              current.append(t)
  
      if cache_t is not None:
  
          class LoadFromCache:
              def __call__(self, data):
                  return cache_t.load(data)
  
          d = run_transforms(
              data,
              [LoadFromCache()],
              log_prefix="PRE",
              use_compose=False,
          )
  
          # Failed/Cache-Miss (run everything)
          if d is None:
              return run_transforms(
                  data, transforms, log_prefix="PRE", use_compose=False
              )
          return (
              run_transforms(
                  d, post_cache, log_prefix="PRE", use_compose=False
              )
              if post_cache
              else d
          )
  
      return run_transforms(
          data, transforms, log_prefix="PRE", use_compose=False
      )
  
imports: import copy
  import logging
  import os
  import time
  from abc import abstractmethod
  from enum import Enum
  from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
  import torch
  from monai.data import decollate_batch
  from monai.inferers import Inferer, SimpleInferer, SlidingWindowInferer
  from monai.utils import deprecated
  from monailabel.interfaces.exception import MONAILabelError, MONAILabelException
  from monailabel.interfaces.tasks.infer_v2 import InferTask, InferType
  from monailabel.interfaces.utils.transform import dump_data, run_transforms
  from monailabel.transform.cache import CacheTransformDatad
  from monailabel.transform.writer import ClassificationWriter, DetectionWriter, Writer
  from monailabel.utils.others.generic import device_list, device_map, name_to_device
label_desc: Use image node_id 13 for calling the BasicInferTask obj's underlying member method code with example usage: obj.run_pre_transforms(data, transforms) and returns: run_transforms, unknown, run_transforms, cache_t