code: def _make_sample_transform(
      image_transform: Optional[Callable] = None,
      target_transform: Optional[Callable] = None,
  ):
      def transform(sample):
          image, target = sample
          if image_transform is not None:
              image = image_transform(image)
          if target_transform is not None:
              target = target_transform(target)
          return image, target
  
      return transform
  
file_path: dinov2/dinov2/data/loaders.py
imports: import logging
  from enum import Enum
  from typing import Any, Callable, List, Optional, TypeVar
  import torch
  from torch.utils.data import Sampler
  from .datasets import ImageNet, ImageNet22k
  from .samplers import EpochSampler, InfiniteSampler, ShardedInfiniteSampler
label_desc: Use image node_id 2 for calling a global function with example usage: _make_sample_transform(image_transform, target_transform) and returns: transform, image,  target