code: def test_half_spmm(idtype, dtype, rtol, atol):
      if F._default_context_str == "cpu" and dtype == torch.float16:
          pytest.skip("float16 is not supported on CPU.")
      if (
          F._default_context_str == "gpu"
          and dtype == torch.bfloat16
          and not torch.cuda.is_bf16_supported()
      ):
          pytest.skip("BF16 is not supported.")
  
      # make sure the spmm result is < 512 to match the rtol/atol we set.
      g = dgl.graph(
          (torch.arange(900), torch.tensor([0] * 900)),
          idtype=idtype,
          device=F.ctx(),
      )
      feat_fp32 = torch.rand((g.num_src_nodes(), 32)).to(F.ctx())
      feat_half = feat_fp32.to(dtype)
  
      # test SpMMCSR
      g = g.formats(["csc"])
      res_fp32 = dgl.ops.copy_u_sum(g, feat_fp32)[0]
      res_half = dgl.ops.copy_u_sum(g, feat_half)[0].float()
      assert torch.allclose(res_fp32, res_half, rtol=rtol, atol=atol)
  
imports: import random
  import unittest
  import backend
  import dgl
  import numpy
  import pytest
  import torch
  from dgl.ops import gather_mm, gsddmm, gspmm, segment_reduce
  from utils import parametrize_idtype
  from utils.graph_cases import get_cases
label_desc: Use image node_id 5 for calling a global function with example usage: test_half_spmm(idtype, dtype, rtol, atol) without return types