code: def compute_gradient_norm(params: Iterable[torch.Tensor]) -> float:
      """Computes the cumulative gradient norm of all provided parameters.
  
      :param params: Iterable over model parameters.
      :return: The cumulative gradient norm.
      """
      total_norm = 0.0
      for p in params:
          if p.requires_grad and np.prod(p.shape) > 0:
              param_norm = p.grad.data.norm(2)
              total_norm += param_norm.item() ** 2
      total_norm = total_norm ** (1.0 / 2)
  
      return total_norm
  
file_path: maze/maze/train/utils/train_utils.py
imports: from collections import defaultdict
  from typing import List, Dict, Iterable, Union
  import numpy
  import torch
  from maze.core.env.structured_env import ActorID
label_desc: Use image node_id 3 for calling a global function with example usage: compute_gradient_norm(params) and returns: total_norm