code: def test_softmax(g, idtype):
      g = g.astype(idtype).to(F.ctx())
      g.ndata["h"] = F.randn((g.num_nodes(), 3))
      g.edata["h"] = F.randn((g.num_edges(), 2))
  
      # Test.1: node readout
      x = dgl.softmax_nodes(g, "h")
      subg = dgl.unbatch(g)
      subx = []
      for sg in subg:
          subx.append(F.softmax(sg.ndata["h"], dim=0))
      assert F.allclose(x, F.cat(subx, dim=0))
  
      # Test.2: edge readout
      x = dgl.softmax_edges(g, "h")
      subg = dgl.unbatch(g)
      subx = []
      for sg in subg:
          subx.append(F.softmax(sg.edata["h"], dim=0))
      assert F.allclose(x, F.cat(subx, dim=0))
  
file_path: dgl/tests/python/common/test_readout.py
imports: import unittest
  import backend
  import dgl
  import networkx
  import numpy
  import pytest
  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_softmax(g, idtype) without return types