code: def detect_channel_prune_type(masks, model):
      """
      User can prune a channel through two ways: 1) prune
      the corresponding filter of the conv layer(all the
      filter related pruner), 2) prune the BN layers that
      followed after a conv(Slim pruner). This function find
      the pruning type of the masks.
  
      Parameters
      ----------
      masks: dict
          A dict object that stores the masks.
      model: nn.Module
          Model object which the mask can be applied on.
  
      Returns:
      -------
      prune_type: str
          Could be Filter or Batchnorm
      """
      prune_type = "Filter"
      all_batch_norm = True
      for layer_name in masks:
          m = get_nested_attr(model, layer_name)
          if m is None or (not isinstance(m, torch.nn.BatchNorm2d)):
              all_batch_norm = False
              break
      if all_batch_norm:
          # if all masks are for batchnorm layers, then the prune_type is BatchNorm
          # Note, actually we currently do not support pruning both Conv and BatchNorm
          # at the same time.
          prune_type = "Batchnorm"
      return prune_type
  
imports: import os
  import logging
  import torch
  import numpy
  from .attr import get_nested_attr
  from .shape_dependency import ChannelDependency, GroupDependency, InputChannelDependency
label_desc: Use image node_id 2 for calling a global function with example usage: detect_channel_prune_type(masks, model) and returns: prune_type