code: def test_static_graph(self):
      path = "./tmp"
      dim = 100
  
      # Load DyGraph Model
  
      paddle.disable_static()
      num_nodes = 5
      edges = [(0, 1), (1, 2), (3, 4)]
      nfeat = np.random.randn(num_nodes, dim).astype("float32")
  
      model = GNNModel(dim, 10)
      out = model(
          paddle.to_tensor(num_nodes),
          paddle.to_tensor(edges),
          paddle.to_tensor(nfeat),
      )
      out = out.numpy()
  
      paddle.save(
          model.state_dict(), os.path.join(path, "static_gnn.pdparam")
      )
  
      paddle.enable_static()
  
      # Run Static Fisrt
  
      model2 = GNNModel(dim, 10)
      input_num_nodes = static.data(
          name="num_nodes", shape=[-1], dtype="int32"
      )
      input_edges = static.data(
          name="edges", shape=[-1, 2], dtype="int32"
      )
      input_feature = static.data(
          name="feature", shape=[-1, dim], dtype="float32"
      )
      output = model2(input_num_nodes, input_edges, input_feature)
  
      place = paddle.CPUPlace()
      exe = static.Executor(place)
      exe.run(static.default_startup_program())
      prog = static.default_main_program()
  
      state_dict = paddle.load(os.path.join(path, "static_gnn.pdparam"))
      model2.set_state_dict(state_dict)
  
      feed_dict = {
          "num_nodes": np.array([num_nodes]).astype("int32"),
          "edges": np.array(edges, dtype="int32"),
          "feature": nfeat.astype("float32"),
      }
      out2 = exe.run(prog, feed=feed_dict, fetch_list=[output])[0]
  
      eps = np.sum((out2 - out) ** 2)
      self.assertTrue(eps < 1e-5)
  
      import shutil
  
      shutil.rmtree(path)
  
file_path: PGL/tests/test_static_graph.py
imports: import unittest
  import os
  import numpy
  import paddle
  import pgl
  import paddle.nn
  import pgl.nn
  import pgl.nn.functional
  import paddle.static
label_desc: Use image node_id 1 for calling the StaticGraphOpTest obj's underlying member method code with example usage: obj.test_static_graph() without return types