code: def test_glob_att_pool():
      g = dgl.from_networkx(nx.path_graph(10)).to(F.ctx())
      ctx = F.ctx()
  
      gap = nn.GlobalAttentionPooling(
          gluon.nn.Dense(1), gluon.nn.Dense(10)
      )
      gap.initialize(ctx=ctx)
      print(gap)
      # test#1: basic
      h0 = F.randn((g.num_nodes(), 5))
      h1 = gap(g, h0)
      assert h1.shape[0] == 1 and h1.shape[1] == 10 and h1.ndim == 2
  
      # test#2: batched graph
      bg = dgl.batch([g, g, g, g])
      h0 = F.randn((bg.num_nodes(), 5))
      h1 = gap(bg, h0)
      assert h1.shape[0] == 4 and h1.shape[1] == 10 and h1.ndim == 2
  
imports: import backend
  import dgl
  import dgl.function
  import dgl.nn.mxnet
  import mxnet
  import networkx
  import numpy
  import pytest
  import scipy
  from mxnet import autograd, gluon, nd
  from utils import parametrize_idtype
  from utils.graph_cases import get_cases, random_bipartite, random_dglgraph, random_graph
label_desc: Use image node_id 31 for calling a global function with example usage: test_glob_att_pool() without return types