class_docstr: PoolTest
      
class_docstr_tok: ["PoolTest"]
docstr: pgl.nn.GlobalAttention test
          
docstr_tok: ["pgl.nn.GlobalAttention","test"]
code: def test_globalattention(self):
      """pgl.nn.GlobalAttention test"""
      data1 = paddle.to_tensor(
          np.array([[1, 2, 3], [3, 2, 1], [4, 5, 6]], dtype="float32")
      )
      data2 = paddle.to_tensor(
          np.array([[1, 2, 3], [3, 2, 1]], dtype="float32")
      )
      data3 = paddle.to_tensor(np.array([[1, 2, 3]], dtype="float32"))
      data = paddle.concat([data1, data2, data3], axis=0)
      common_edges = [(0, 0)]
      graph = pgl.Graph.disjoint(
          [
              pgl.Graph(num_nodes=i, edges=common_edges)
              for i in [3, 2, 1]
          ],
          merged_graph_index=False,
      ).tensor()
      gpool = GlobalAttention(paddle.nn.Linear(3, 1))
      output = gpool(graph, data)
      data1 = paddle.to_tensor(
          np.array([[4, 5, 6], [3, 2, 1], [1, 2, 3]], dtype="float32")
      )
      data2 = paddle.to_tensor(
          np.array([[3, 2, 1], [1, 2, 3]], dtype="float32")
      )
      data3 = paddle.to_tensor(np.array([[1, 2, 3]], dtype="float32"))
      data = paddle.concat([data1, data2, data3], axis=0)
      output_mix = gpool(graph, data)
      # permutation invariance test
      np.testing.assert_almost_equal(
          output_mix.numpy().reshape(
              -1,
          ),
          output.numpy().reshape(
              -1,
          ),
          decimal=5,
      )
  
imports: import os
  import sys
  import re
  import time
  import unittest
  import numpy
  import math
  import paddle
  import pgl
  from pgl.utils.logger import log
  from pgl.math import segment_sum
  from pgl.nn import Set2Set, GlobalAttention, SAGPool, GraphPool
  from pgl.nn import GraphMultisetTransformer
label_desc: Use image node_id 1 for calling the PoolTest obj's underlying member method code with example usage: obj.test_globalattention() without return types