code: def test_custom_model_summary_callback_summarize(tmpdir):
      class CustomModelSummary(ModelSummary):
          @staticmethod
          def summarize(
              summary_data: List[List[Union[str, List[str]]]],
              total_parameters: int,
              trainable_parameters: int,
              model_size: float,
          ) -> None:
              assert summary_data[1][0] == "Name"
              assert summary_data[1][1][0] == "layer"
  
              assert summary_data[2][0] == "Type"
              assert summary_data[2][1][0] == "Linear"
  
              assert summary_data[3][0] == "Params"
              assert total_parameters == 66
              assert trainable_parameters == 66
  
      model = BoringModel()
      trainer = Trainer(
          default_root_dir=tmpdir,
          callbacks=CustomModelSummary(),
          max_steps=1,
      )
  
      trainer.fit(model)
  
file_path: pytorch-lightning/tests/tests_pytorch/callbacks/test_model_summary.py
imports: from typing import List, Union
  from lightning.pytorch import Trainer
  from lightning.pytorch.callbacks import ModelSummary
  from lightning.pytorch.demos.boring_classes import BoringModel
label_desc: Use image node_id 4 for calling a global function with example usage: test_custom_model_summary_callback_summarize(tmpdir) without return types