code: def squash(s, dim=1):
      sq = th.sum(s**2, dim=dim, keepdim=True)
      s_norm = th.sqrt(sq)
      s = (sq / (1.0 + sq)) * (s / s_norm)
      return s
  
file_path: dgl/examples/pytorch/capsule/DGLRoutingLayer.py
imports: import dgl
  import torch
  import torch.nn
  import torch.nn.functional
label_desc: Use image node_id 1 for calling a global function with example usage: squash(s, dim) and returns: s