code: def node_classify_generator(
      graph, all_nodes=None, batch_size=512, epoch=1, shuffle=True
  ):
      """Data generator for node classify.
  
      Args:
          graph: The :code:`Graph` data object.
  
          all_nodes: the total number of nodes.
  
          batch_size: batch size for training.
  
          epoch: The number of epochs.
  
          shuffle: Random shuffle of data.
      """
  
      if all_nodes is None:
          all_nodes = np.arange(graph.num_nodes)
  
      def batch_nodes_generator(shuffle=shuffle):
          """Batch nodes generator."""
          perm = np.arange(len(all_nodes), dtype=np.int64)
          if shuffle:
              np.random.shuffle(perm)
          start = 0
          while start < len(all_nodes):
              yield all_nodes[perm[start : start + batch_size]]
              start += batch_size
  
      def wrapper():
          """Wrapper function."""
          for _ in range(epoch):
              for batch_nodes in batch_nodes_generator():
                  batch_nodes_expanded = np.expand_dims(
                      batch_nodes, -1
                  ).astype(np.int64)
                  batch_labels = graph.node_feat["group_id"][
                      batch_nodes
                  ].astype(np.float32)
                  yield [batch_nodes_expanded, batch_labels]
  
      return wrapper
  
file_path: PGL/legacy/examples/line/multi_class.py
imports: import argparse
  import time
  import math
  import os
  import random
  import numpy
  import sklearn.metrics
  from sklearn.metrics import f1_score
  import pgl
  from pgl.utils import op
  import paddle.fluid
  import paddle.fluid.layers
  from pgl.utils.logger import log
  from data_loader import FlickrDataset
label_desc: Use image node_id 4 for calling a global function with example usage: node_classify_generator(graph, all_nodes, batch_size, epoch, shuffle) and returns: wrapper