docstr: Transforms to apply to a whole batch (if possible use this for efficiency).
  
  .. note::     This function won't be called within the dataloader workers, since to make that happen     each of
  the workers would have to create it's own CUDA-context which would pollute GPU memory (if on GPU).
docstr_tok: ["Transforms","to","apply","to","a","whole","batch","(","if","possible","use","this","for","efficiency",")",".","..","note",":",":","This","function","wo","n't","be","called","within","the","dataloader","workers",",","since","to","make","that","happen","each","of","the","workers","would","have","to","create","it","'s","own","CUDA-context","which","would","pollute","GPU","memory","(","if","on","GPU",")","."]
code: def _per_batch_transform_on_device(
      self, batch: Any, stage: RunningStage
  ) -> Any:
      """Transforms to apply to a whole batch (if possible use this for efficiency).
  
      .. note::     This function won't be called within the dataloader workers, since to make that happen     each of
      the workers would have to create it's own CUDA-context which would pollute GPU memory (if on GPU).
  
      """
      return self.current_transform(
          stage=stage, current_fn="per_batch_transform_on_device"
      )(batch)
  
imports: import inspect
  from dataclasses import dataclass
  from functools import partial
  from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple
  from pytorch_lightning.utilities import rank_zero_warn
  from pytorch_lightning.utilities.enums import LightningEnum
  from flash.core.data.callback import ControlFlow
  from flash.core.data.utilities.collate import default_collate
  from flash.core.data.utils import _STAGES_PREFIX
  from flash.core.utilities.stages import RunningStage
  from flash.core.utilities.types import INPUT_TRANSFORM_TYPE
label_desc: Use image node_id 37 for calling the InputTransform obj's underlying member method code with example usage: obj._per_batch_transform_on_device(batch, stage) and returns: self