def _forward_example_input(self) -> None:
        """Run the example input through each layer to get input- and output sizes."""
        model = self._model
        # the summary is supported without a trainer instance so we need to use the underscore property
        trainer = self._model._trainer

        input_ = model.example_input_array
        input_ = model._on_before_batch_transfer(input_)
        input_ = model._apply_batch_transfer_handler(input_)

        mode = _ModuleMode()
        mode.capture(model)
        model.eval()

        # FlopCounterMode does not support ScriptModules before torch 2.4.0, so we use a null context
        flop_context = (
            contextlib.nullcontext()
            if (
                not _TORCH_GREATER_EQUAL_2_4
                and any(isinstance(m, torch.jit.ScriptModule) for m in self._model.modules())
            )
            else self._flop_counter
        )

        forward_context = contextlib.nullcontext() if trainer is None else trainer.precision_plugin.forward_context()
        with torch.no_grad(), forward_context, flop_context:
            # let the model hooks collect the input- and output shapes
            if isinstance(input_, (list, tuple)):
                model(*input_)
            elif isinstance(input_, dict):
                model(**input_)
            else:
                model(input_)
        mode.restore(model)
Run the example input through each layer to get input- and output sizes.
src/lightning/pytorch/utilities/model_summary/model_summary.py