code: def consis_loss(logps, temp, lam):
      ps = [th.exp(p) for p in logps]
      ps = th.stack(ps, dim=2)
  
      avg_p = th.mean(ps, dim=2)
      sharp_p = (
          th.pow(avg_p, 1.0 / temp)
          / th.sum(th.pow(avg_p, 1.0 / temp), dim=1, keepdim=True)
      ).detach()
  
      sharp_p = sharp_p.unsqueeze(2)
      loss = th.mean(
          th.sum(th.pow(ps - sharp_p, 2), dim=1, keepdim=True)
      )
  
      loss = lam * loss
      return loss
  
file_path: dgl/examples/pytorch/grand/main.py
imports: import argparse
  import warnings
  import dgl
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  import torch.optim
  from dgl.data import CiteseerGraphDataset, CoraGraphDataset, PubmedGraphDataset
  from model import GRAND
label_desc: Use image node_id 2 for calling a global function with example usage: consis_loss(logps, temp, lam) and returns: loss