code: def compute_representations(net, dataset, device):
      r"""Pre-computes the representations for the entire data.
      Returns:
          [torch.Tensor, torch.Tensor]: Representations and labels.
      """
      net.eval()
      reps = []
      labels = []
  
      if len(dataset) == 1:
          g = dataset[0]
          g = dgl.add_self_loop(g)
          g = g.to(device)
          with torch.no_grad():
              reps.append(net(g))
              labels.append(g.ndata["label"])
      else:
          for g in dataset:
              # forward
              g = g.to(device)
              with torch.no_grad():
                  reps.append(net(g))
                  labels.append(g.ndata["label"])
  
      reps = torch.cat(reps, dim=0)
      labels = torch.cat(labels, dim=0)
      return [reps, labels]
  
imports: import copy
  import dgl
  import torch
  from dgl.nn.pytorch.conv import GraphConv, SAGEConv
  from torch import nn
  from torch.nn import BatchNorm1d, Parameter
  from torch.nn.init import ones_, zeros_
label_desc: Use image node_id 1 for calling a global function with example usage: compute_representations(net, dataset, device) and returns: list