class_docstr: A structured pruning masker base class that prunes convolutional layer filters.
  
  Parameters
  ----------
  model: nn.Module
      model to be pruned
  pruner: Pruner
      A Pruner instance used to prune the model
  preserve_round: int
      after pruning, preserve filters/channels round to `preserve_round`, for example:
      for a Conv2d layer, output channel is 32, sparsity is 0.2, if preserve_round is
      1 (no preserve round), then there will be int(32 * 0.2) = 6 filters pruned, and
      32 - 6 = 26 filters are preserved. If preserve_round is 4, preserved filters will
      be round up to 28 (which can be divided by 4) and only 4 filters are pruned.
class_docstr_tok: ["A","structured","pruning","masker","base","class","that","prunes","convolutional","layer","filters",".","Parameters","--","--","--","--","--","model",":","nn.Module","model","to","be","pruned","pruner",":","Pruner","A","Pruner","instance","used","to","prune","the","model","preserve_round",":","int","after","pruning",",","preserve","filters\/channels","round","to","`","preserve_round","`",",","for","example",":","for","a","Conv2d","layer",",","output","channel","is","32",",","sparsity","is","0.2",",","if","preserve_round","is","1","(","no","preserve","round",")",",","then","there","will","be","int","(","32","*","0.2",")","=","6","filters","pruned",",","and","32","-","6","=","26","filters","are","preserved",".","If","preserve_round","is","4",",","preserved","filters","will","be","round","up","to","28","(","which","can","be","divided","by","4",")","and","only","4","filters","are","pruned","."]
docstr: Calculate the mask of given layer.
  Parameters
  ----------
  base_mask: dict
      The basic mask with the same shape of weight, all item in the basic mask is 1.
  weight: tensor
      the module weight to be pruned
  num_prune: int
      Num of filters to prune
  wrapper: PrunerModuleWrapper
      layer wrapper of this layer
  wrapper_idx: int
      index of this wrapper in pruner's all wrappers
  channel_masks: Tensor
      If mask some channels for this layer in advance. In the dependency-aware
      mode, before calculating the masks for each layer, we will calculate a common
      mask for all the layers in the dependency set. For the pruners that doesnot
      support dependency-aware mode, they can just ignore this parameter.
  Returns
  -------
  dict
      dictionary for storing masks
docstr_tok: ["Calculate","the","mask","of","given","layer",".","Parameters","--","--","--","--","--","base_mask",":","dict","The","basic","mask","with","the","same","shape","of","weight",",","all","item","in","the","basic","mask","is","1.","weight",":","tensor","the","module","weight","to","be","pruned","num_prune",":","int","Num","of","filters","to","prune","wrapper",":","PrunerModuleWrapper","layer","wrapper","of","this","layer","wrapper_idx",":","int","index","of","this","wrapper","in","pruner","'s","all","wrappers","channel_masks",":","Tensor","If","mask","some","channels","for","this","layer","in","advance",".","In","the","dependency-aware","mode",",","before","calculating","the","masks","for","each","layer",",","we","will","calculate","a","common","mask","for","all","the","layers","in","the","dependency","set",".","For","the","pruners","that","doesnot","support","dependency-aware","mode",",","they","can","just","ignore","this","parameter",".","Returns","--","--","--","-","dict","dictionary","for","storing","masks"]
code: def get_mask(
      self,
      base_mask,
      weight,
      num_prune,
      wrapper,
      wrapper_idx,
      channel_masks=None,
  ):
      """
      Calculate the mask of given layer.
      Parameters
      ----------
      base_mask: dict
          The basic mask with the same shape of weight, all item in the basic mask is 1.
      weight: tensor
          the module weight to be pruned
      num_prune: int
          Num of filters to prune
      wrapper: PrunerModuleWrapper
          layer wrapper of this layer
      wrapper_idx: int
          index of this wrapper in pruner's all wrappers
      channel_masks: Tensor
          If mask some channels for this layer in advance. In the dependency-aware
          mode, before calculating the masks for each layer, we will calculate a common
          mask for all the layers in the dependency set. For the pruners that doesnot
          support dependency-aware mode, they can just ignore this parameter.
      Returns
      -------
      dict
          dictionary for storing masks
      """
      raise NotImplementedError(
          "{} get_mask is not implemented".format(
              self.__class__.__name__
          )
      )
  
imports: import logging
  import math
  import numpy
  import torch
  from .weight_masker import WeightMasker
label_desc: Use image node_id 7 for calling the StructuredWeightMasker obj's underlying member method code with example usage: obj.get_mask(base_mask, weight, num_prune, wrapper, wrapper_idx, channel_masks) without return types