code: def compute_grad_mag(E, cuda=False):
      E_ = convTri(E, 4, cuda)
      Ox, Oy = numerical_gradients_2d(E_, cuda)
      mag = torch.sqrt(torch.mul(Ox, Ox) + torch.mul(Oy, Oy) + 1e-6)
      mag = mag / mag.max()
  
      return mag
  
file_path: pywick/pywick/models/segmentation/testnets/gscnn/my_functionals/custom_functional.py
imports: import torch
  import torch.nn.functional
  from torchvision.transforms.functional import pad
  import numpy
label_desc: Use image node_id 9 for calling a global function with example usage: compute_grad_mag(E, cuda) and returns: mag