code: def _call_setup_hook(trainer: "pl.Trainer") -> None:
      assert trainer.state.fn is not None
      fn = trainer.state.fn
  
      # It is too early to move the model to the device, but we fake the `LightningModule.device` property
      # so the user can access it in the `LightningModule.setup` hook
      for module in trainer.lightning_module.modules():
          if isinstance(module, _DeviceDtypeModuleMixin):
              module._device = trainer.strategy.root_device
  
      # Trigger lazy creation of experiment in loggers so loggers have their metadata available
      for logger in trainer.loggers:
          if hasattr(logger, "experiment"):
              _ = logger.experiment
  
      trainer.strategy.barrier("pre_setup")
  
      if trainer.datamodule is not None:
          _call_lightning_datamodule_hook(trainer, "setup", stage=fn)
      _call_callback_hooks(trainer, "setup", stage=fn)
      _call_lightning_module_hook(trainer, "setup", stage=fn)
  
      trainer.strategy.barrier("post_setup")
  
imports: import logging
  from copy import deepcopy
  from typing import Any, Callable, Dict, Optional, Type, Union
  from packaging.version import Version
  import lightning.pytorch
  from lightning.fabric.utilities.device_dtype_mixin import _DeviceDtypeModuleMixin
  from lightning.pytorch.callbacks import Checkpoint, EarlyStopping
  from lightning.pytorch.trainer.states import TrainerStatus
  from lightning.pytorch.utilities.exceptions import _TunerExitException
  from lightning.pytorch.utilities.model_helpers import is_overridden
  from lightning.pytorch.utilities.rank_zero import rank_zero_warn
label_desc: Use image node_id 2 for calling a global function with example usage: _call_setup_hook(trainer) without return types