code: def check_lazy_init(
      entry: TestingEntry,
      seed: int = 42,
      verbose: bool = False,
      check_forward: bool = False,
      default_device: str = "cpu",
  ) -> None:
      model_fn, data_gen_fn, output_transform_fn, _, model_attr = entry
      _MyTensor._pre_op_fn = lambda *args: set_seed(seed)
      LazyTensor._pre_op_fn = lambda *args: set_seed(seed)
      ctx = LazyInitContext(
          tensor_cls=_MyTensor, default_device=default_device
      )
      with ctx:
          model = model_fn()
      ctx = LazyInitContext(default_device=default_device)
      with ctx:
          deferred_model = model_fn()
          copied_deferred_model = deepcopy(deferred_model)
      deferred_model = ctx.materialize(deferred_model, verbose=verbose)
      copied_deferred_model = ctx.materialize(
          copied_deferred_model, verbose=verbose
      )
      assert_model_equal(model, deferred_model)
      assert_model_equal(deferred_model, copied_deferred_model)
      if check_forward:
          assert_forward_equal(
              model, deferred_model, data_gen_fn, output_transform_fn
          )
          assert_forward_equal(
              deferred_model,
              copied_deferred_model,
              data_gen_fn,
              output_transform_fn,
          )
      if verbose:
          print(f"{model.__class__.__name__} pass")
  
file_path: ColossalAI/tests/test_lazy/lazy_init_utils.py
imports: import random
  from copy import deepcopy
  from typing import Any, Callable, Optional, Tuple
  import numpy
  import torch
  from packaging import version
  from colossalai.device.device_mesh import DeviceMesh
  from colossalai.lazy.lazy_init import LazyInitContext, LazyTensor, _MyTensor
  from colossalai.tensor.d_tensor import to_global
  from colossalai.tensor.d_tensor.layout import Layout
  from tests.kit.model_zoo.registry import ModelAttribute
label_desc: Use image node_id 4 for calling a global function with example usage: check_lazy_init(entry, seed, verbose, check_forward, default_device) without return types