class_docstr: Filter Pruning via Geometric Median (FPGM) Structured Pruner
  This sparsifier prune fliter (row) in a tensor according to distances among filters according to
  `Filter Pruning via Geometric Median for Deep Convolutional Neural Networks Acceleration <https://arxiv.org/abs/1811.00250>`_.
  
  This sparsifier is controlled by three variables:
  1. `sparsity_level` defines the number of filters (rows) that are zeroed-out.
  2. `dist` defines the distance measurement type. Default: 3 (L2 distance).
  Available options are: [1, 2, (custom callable distance function)].
  
  Note::
      Inputs should be a 4D convolutional tensor of shape (N, C, H, W).
          - N: output channels size
          - C: input channels size
          - H: height of kernel
          - W: width of kernel
docstr: Compute distance across all entries in tensor `t` along all dimension
  except for the one identified by dim.
  Args:
      t (torch.Tensor): tensor representing the parameter to prune
  Returns:
      distance (torch.Tensor): distance computed across filtters
docstr_tok: ["Compute","distance","across","all","entries","in","tensor","`","t","`","along","all","dimension","except","for","the","one","identified","by","dim",".","Args",":","t","(","torch.Tensor",")",":","tensor","representing","the","parameter","to","prune","Returns",":","distance","(","torch.Tensor",")",":","distance","computed","across","filtters"]
code: def _compute_distance(self, t):
      r"""Compute distance across all entries in tensor `t` along all dimension
      except for the one identified by dim.
      Args:
          t (torch.Tensor): tensor representing the parameter to prune
      Returns:
          distance (torch.Tensor): distance computed across filtters
      """
      dim = 0  # prune filter (row)
  
      size = t.size(dim)
      slc = [slice(None)] * t.dim()
  
      # flatten the tensor along the dimension
      t_flatten = [
          t[
              tuple(slc[:dim] + [slice(i, i + 1)] + slc[dim + 1 :])
          ].reshape(-1)
          for i in range(size)
      ]
      t_flatten = torch.stack(t_flatten)
  
      # distance measurement
      dist_matrix = self.dist_fn(t_flatten)
  
      # more similar with other filter indicates large in the sum of row
      distance = torch.sum(torch.abs(dist_matrix), 1)
  
      return distance
  
file_path: pytorch/torch/ao/pruning/_experimental/pruner/FPGM_pruner.py
imports: from typing import Callable, Optional, Union
  import torch
  from .base_structured_sparsifier import BaseStructuredSparsifier
label_desc: Use image node_id 2 for calling the FPGMPruner obj's underlying member method code with example usage: obj._compute_distance(t) and returns: distance