class_docstr: GraphGatherTest
      
docstr: test_graph_gather
          
docstr_tok: ["test_graph_gather"]
code: def test_graph_gather(self):
      """test_graph_gather"""
      np.random.seed(1)
  
      graph_list = []
  
      num_graph = 10
      for _ in range(num_graph):
          num_nodes = np.random.randint(5, 20)
          edges = np.random.randint(low=0, high=num_nodes, size=(10, 2))
          node_feat = {
              "feature": np.random.rand(num_nodes, 4).astype("float32")
          }
          g = graph.Graph(
              num_nodes=num_nodes, edges=edges, node_feat=node_feat
          )
          graph_list.append(g)
  
      gg = graph.MultiGraph(graph_list)
  
      use_cuda = False
      place = F.CUDAPlace(0) if use_cuda else F.CPUPlace()
  
      prog = F.Program()
      startup_prog = F.Program()
      with F.program_guard(prog, startup_prog):
          gw = graph_wrapper.GraphWrapper(
              name="graph",
              place=place,
              node_feat=g.node_feat_info(),
              edge_feat=g.edge_feat_info(),
          )
  
          index = L.data(name="index", dtype="int32", shape=[-1])
          feats = pgl.layers.graph_gather(
              gw, gw.node_feat["feature"], index
          )
  
      exe = F.Executor(place)
      exe.run(startup_prog)
      feed_dict = gw.to_feed(gg)
      feed_dict["index"] = np.zeros(num_graph, dtype="int32")
      ret = exe.run(prog, feed=feed_dict, fetch_list=[feats])
      self.assertEqual(list(ret[0].shape), [num_graph, 4])
      for i in range(num_graph):
          dist = ret[0][i] - graph_list[i].node_feat["feature"][0]
          dist = np.sum(dist**2)
          self.assertLess(dist, 1e-15)
  
file_path: PGL/legacy/pgl/tests/test_graph_gather.py
imports: from __future__ import division
  from __future__ import absolute_import
  from __future__ import print_function
  from __future__ import unicode_literals
  import unittest
  import numpy
  import paddle.fluid
  import paddle.fluid.layers
  import pgl
  from pgl import graph
  from pgl import graph_wrapper
label_desc: Use image node_id 1 for calling the GraphGatherTest obj's underlying member method code with example usage: obj.test_graph_gather() without return types