code: def check_grad_equal(p: Parameter, colo_p: ColoParameter) -> None:
      pg = colo_p.get_process_group()
      if p.shape != colo_p.shape:
          grad = p.grad.chunk(pg.tp_world_size(), 0)[pg.tp_local_rank()]
      else:
          grad = p.grad
      assert torch.allclose(
          grad, colo_p.grad
      ), f"diff: {torch.abs(grad - colo_p.grad)}"
  
file_path: colossalai/tests/test_legacy/test_utils/test_norm_gradient_clipping.py
imports: import pytest
  import torch
  from torch.nn.parameter import Parameter
  from torch.nn.utils import clip_grad_norm_
  import colossalai
  from colossalai.legacy.tensor import ColoTensorSpec, ProcessGroup, distspec
  from colossalai.legacy.utils.common import clip_grad_norm
  from colossalai.logging import disable_existing_loggers
  from colossalai.tensor.colo_parameter import ColoParameter
  from colossalai.testing import parameterize, rerun_if_address_is_in_use, spawn
  from colossalai.utils import get_current_device
label_desc: Use image node_id 3 for calling a global function with example usage: check_grad_equal(p, colo_p) without return types