class_docstr: DiffPool Fuse
class_docstr_tok: ["DiffPool","Fuse"]
docstr: loss function
docstr_tok: ["loss","function"]
code: def loss(self, pred, label):
      """
      loss function
      """
      # softmax + CE
      criterion = nn.CrossEntropyLoss()
      loss = criterion(pred, label)
      for key, value in self.first_diffpool_layer.loss_log.items():
          loss += value
      for diffpool_layer in self.diffpool_layers:
          for key, value in diffpool_layer.loss_log.items():
              loss += value
      return loss
  
file_path: dgl/examples/pytorch/diffpool/model/encoder.py
imports: import time
  import dgl
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from scipy.linalg import block_diag
  from torch.nn import init
  from .dgl_layers import DiffPoolBatchedGraphLayer, GraphSage, GraphSageLayer
  from .model_utils import batch2tensor
  from .tensorized_layers import *
label_desc: Use image node_id 5 for calling the DiffPool obj's underlying member method code with example usage: obj.loss(pred, label) and returns: loss