code: def check_grad(model: GeminiDDP, torch_model: torch.nn.Module):
      chunk_manager = model.chunk_manager
      param_list = [p for p in model.parameters()]
      chunk_list = chunk_manager.get_chunks(param_list)
      if not model.reuse_fp16_chunk:
          chunk_list = [chunk.grad_chunk for chunk in chunk_list]
      for chunk in chunk_list:
          chunk_manager.access_chunk(chunk)
  
      for p0, p1 in zip(model.parameters(), torch_model.parameters()):
          assert_close(p0, p1.grad, rtol=1e-3, atol=5e-5)
  
file_path: ColossalAI/tests/test_zero/test_gemini/test_fwd_bwd.py
imports: import pytest
  import torch
  import torch.distributed
  from torch.nn.parallel import DistributedDataParallel
  from torch.testing import assert_close
  import colossalai
  from colossalai.legacy.amp import convert_to_apex_amp
  from colossalai.nn.optimizer import HybridAdam
  from colossalai.testing import parameterize, rerun_if_address_is_in_use, spawn
  from colossalai.utils import set_seed
  from colossalai.utils.device import get_current_device
  from colossalai.zero import GeminiDDP, GeminiOptimizer
  from colossalai.zero.gemini.chunk import search_chunk_configuration
  from tests.kit.model_zoo import model_zoo, run_fwd_bwd
label_desc: Use image node_id 1 for calling a global function with example usage: check_grad(model, torch_model) without return types