docstr: Inference with the GraphSAGE model on full neighbors (i.e. without neighbor sampling).
  g : the entire graph.
  x : the input of entire node set.
  
  The inference code is written in a fashion that it could handle any number of nodes and
  layers.
docstr_tok: ["Inference","with","the","GraphSAGE","model","on","full","neighbors","(","i.e",".","without","neighbor","sampling",")",".","g",":","the","entire","graph",".","x",":","the","input","of","entire","node","set",".","The","inference","code","is","written","in","a","fashion","that","it","could","handle","any","number","of","nodes","and","layers","."]
code: def inference(self, g, x, batch_size, device):
      """
      Inference with the GraphSAGE model on full neighbors (i.e. without neighbor sampling).
      g : the entire graph.
      x : the input of entire node set.
  
      The inference code is written in a fashion that it could handle any number of nodes and
      layers.
      """
      # During inference with sampling, multi-layer blocks are very inefficient because
      # lots of computations in the first few layers are repeated.
      # Therefore, we compute the representation of all nodes layer by layer.  The nodes
      # on each layer are of course splitted in batches.
      # TODO: can we standardize this?
      nodes = th.arange(g.num_nodes())
      for l, layer in enumerate(self.layers):
          y = g.ndata["hist_%d" % (l + 1)]
  
          for start in tqdm.trange(0, len(nodes), batch_size):
              end = start + batch_size
              batch_nodes = nodes[start:end]
              block = dgl.to_block(
                  dgl.in_subgraph(g, batch_nodes), batch_nodes
              )
              induced_nodes = block.srcdata[dgl.NID]
  
              h = x[induced_nodes].to(device)
              block = block.to(device)
              h_dst = h[: block.number_of_dst_nodes()]
              h = layer(block, (h, h_dst))
  
              y[start:end] = h.cpu()
  
          x = y
      return y
  
imports: import argparse
  import math
  import time
  import traceback
  import dgl
  import dgl.function
  import dgl.nn.pytorch
  import numpy
  import torch
  import torch.multiprocessing
  import torch.nn
  import torch.nn.functional
  import torch.optim
  import tqdm
  from dgl.data import RedditDataset
  from torch.nn.parallel import DistributedDataParallel
  from torch.utils.data import DataLoader
label_desc: Use image node_id 3 for calling the SAGE obj's underlying member method code with example usage: obj.inference(g, x, batch_size, device) and returns: y