code: def test_distributed_degree(self):
      paddle.distributed.init_parallel_env()
      num_nodes = 5
      edges = [(0, 1), (1, 2), (3, 4)]
      g1 = pgl.Graph(edges=edges, num_nodes=num_nodes)
      indegree = np.array([0, 1, 1, 0, 1], dtype="int32")
      outdegree = np.array([1, 1, 0, 1, 0], dtype="int32")
      g1 = pgl.DistGPUGraph(g1)
  
      res = g1.indegree().numpy()
      self.assertTrue(np.all(res == indegree))
  
      # get degree from specific nodes
      res = g1.indegree(nodes=paddle.to_tensor([1, 2, 3])).numpy()
      self.assertTrue(np.all(res == indegree[[1, 2, 3]]))
  
      res = g1.outdegree().numpy()
      self.assertTrue(np.all(res == outdegree))
  
      # get degree from specific nodes
      res = g1.outdegree(nodes=paddle.to_tensor([1, 2, 3])).numpy()
      self.assertTrue(np.all(res == outdegree[[1, 2, 3]]))
  
file_path: PGL/tests/test_dist_graph.py
imports: import os
  import unittest
  import numpy
  import paddle
  import pgl
  import paddle.distributed
  from testsuite import create_random_graph
label_desc: Use image node_id 1 for calling the TestDistGPUGraph obj's underlying member method code with example usage: obj.test_distributed_degree() without return types