code: def test_set2set():
      g = dgl.from_networkx(nx.path_graph(10)).to(F.ctx())
      ctx = F.ctx()
  
      s2s = nn.Set2Set(5, 3, 3)  # hidden size 5, 3 iters, 3 layers
      s2s.initialize(ctx=ctx)
      print(s2s)
  
      # test#1: basic
      h0 = F.randn((g.num_nodes(), 5))
      h1 = s2s(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])
      h0 = F.randn((bg.num_nodes(), 5))
      h1 = s2s(bg, h0)
      assert h1.shape[0] == 3 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 30 for calling a global function with example usage: test_set2set() without return types