code: def _compute_norm(t, n, dim):
      r"""Compute the L_n-norm of a tensor along all dimensions except for the specified dimension.
  
      The L_n-norm will be computed across all entries in tensor `t` along all dimension
      except for the one identified by dim.
      Example: if `t` is of shape, say, 3x2x4 and dim=2 (the last dim),
      then norm will have Size [4], and each entry will represent the
      `L_n`-norm computed using the 3x2=6 entries for each of the 4 channels.
  
      Args:
          t (torch.Tensor): tensor representing the parameter to prune
          n (int, float, inf, -inf, 'fro', 'nuc'): See documentation of valid
              entries for argument p in torch.norm
          dim (int): dim identifying the channels to prune
  
      Returns:
          norm (torch.Tensor): L_n norm computed across all dimensions except
              for `dim`. By construction, `norm.shape = t.shape[-1]`.
      """
      # dims = all axes, except for the one identified by `dim`
      dims = list(range(t.dim()))
      # convert negative indexing
      if dim < 0:
          dim = dims[dim]
      dims.remove(dim)
  
      norm = torch.norm(t, p=n, dim=dims)
      return norm
  
imports: import numbers
  from abc import ABC, abstractmethod
  from collections.abc import Iterable
  from typing import Tuple
  import torch
label_desc: Use image node_id 15 for calling a global function with example usage: _compute_norm(t, n, dim) and returns: norm