def _per_sample_transform_on_device(self, sample: Any, stage: RunningStage) -> Any:
        """Transforms to apply to the data before the collation (per-sample basis).

        .. note::     This option is mutually exclusive with :meth:`per_batch_transform`,     since if both are
        specified, uncollation has to be applied. .. 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).

        """
        fn = self.current_transform(stage=stage, current_fn="per_sample_transform_on_device")
        if isinstance(sample, list):
            return [fn(s) for s in sample]
        return fn(sample)
Transforms to apply to the data before the collation (per-sample basis).

        .. note::     This option is mutually exclusive with :meth:`per_batch_transform`,     since if both are
        specified, uncollation has to be applied. .. 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).

        
src/flash/core/data/io/input_transform.py