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?
      for l, layer in enumerate(self.layers):
          y = th.zeros(
              g.num_nodes(),
              self.n_hidden
              if l != len(self.layers) - 1
              else self.n_classes,
          )
  
          sampler = dgl.dataloading.MultiLayerFullNeighborSampler(1)
          dataloader = dgl.dataloading.DataLoader(
              g,
              th.arange(g.num_nodes()),
              sampler,
              batch_size=batch_size,
              shuffle=True,
              drop_last=False,
              num_workers=4,
          )
  
          for input_nodes, output_nodes, blocks in dataloader:
              block = blocks[0]
  
              block = block.int().to(device)
              h = x[input_nodes].to(device)
              h = layer(block, h)
              if l != len(self.layers) - 1:
                  h = self.activation(h)
                  h = self.dropout(h)
  
              y[output_nodes] = h.cpu()
  
          x = y
      return y
  
file_path: dgl/benchmarks/benchmarks/model_acc/bench_sage_ns.py
imports: import time
  import dgl
  import dgl.nn.pytorch
  import torch
  import torch.multiprocessing
  import torch.nn
  import torch.nn.functional
  import torch.optim
  from torch.utils.data import DataLoader
  from ..None import utils
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