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.
docstr: Some pruner may prune the layers in a iterative way. In each pruning iteration,
  we may get the current state of this wrapper/layer, and continue to prune this layer
  based on the current state. This function is to get the current pruning state of the
  target wrapper/layer.
  Parameters
  ----------
  sparsity: float
      pruning ratio,  preserved weight ratio is `1 - sparsity`
  wrapper: PrunerModuleWrapper
      layer wrapper of this layer
  wrapper_idx: int
      index of this wrapper in pruner's all wrappers
  Returns
  -------
  base_mask: dict
      dict object that stores the mask of this wrapper in this iteration, if it is the
      first iteration, then we create a new mask with all ones. If there is already a
      mask in this wrapper, then we return the existing mask.
  weight: tensor
      the current weight of this layer
  num_prune: int
      how many filters we should prune
docstr_tok: ["Some","pruner","may","prune","the","layers","in","a","iterative","way",".","In","each","pruning","iteration",",","we","may","get","the","current","state","of","this","wrapper\/layer",",","and","continue","to","prune","this","layer","based","on","the","current","state",".","This","function","is","to","get","the","current","pruning","state","of","the","target","wrapper\/layer",".","Parameters","--","--","--","--","--","sparsity",":","float","pruning","ratio",",","preserved","weight","ratio","is","`","1","-","sparsity","`","wrapper",":","PrunerModuleWrapper","layer","wrapper","of","this","layer","wrapper_idx",":","int","index","of","this","wrapper","in","pruner","'s","all","wrappers","Returns","--","--","--","-","base_mask",":","dict","dict","object","that","stores","the","mask","of","this","wrapper","in","this","iteration",",","if","it","is","the","first","iteration",",","then","we","create","a","new","mask","with","all","ones",".","If","there","is","already","a","mask","in","this","wrapper",",","then","we","return","the","existing","mask",".","weight",":","tensor","the","current","weight","of","this","layer","num_prune",":","int","how","many","filters","we","should","prune"]
code: def _get_current_state(self, sparsity, wrapper, wrapper_idx=None):
      """
      Some pruner may prune the layers in a iterative way. In each pruning iteration,
      we may get the current state of this wrapper/layer, and continue to prune this layer
      based on the current state. This function is to get the current pruning state of the
      target wrapper/layer.
      Parameters
      ----------
      sparsity: float
          pruning ratio,  preserved weight ratio is `1 - sparsity`
      wrapper: PrunerModuleWrapper
          layer wrapper of this layer
      wrapper_idx: int
          index of this wrapper in pruner's all wrappers
      Returns
      -------
      base_mask: dict
          dict object that stores the mask of this wrapper in this iteration, if it is the
          first iteration, then we create a new mask with all ones. If there is already a
          mask in this wrapper, then we return the existing mask.
      weight: tensor
          the current weight of this layer
      num_prune: int
          how many filters we should prune
      """
      msg = "module type {} is not supported!".format(wrapper.type)
      assert wrapper.type == "Conv2d", msg
      weight = wrapper.module.weight.data
      bias = None
      if (
          hasattr(wrapper.module, "bias")
          and wrapper.module.bias is not None
      ):
          bias = wrapper.module.bias.data
  
      if wrapper.weight_mask is None:
          mask_weight = (
              torch.ones(weight.size()).type_as(weight).detach()
          )
      else:
          mask_weight = wrapper.weight_mask.clone()
      if bias is not None:
          if wrapper.bias_mask is None:
              mask_bias = torch.ones(bias.size()).type_as(bias).detach()
          else:
              mask_bias = wrapper.bias_mask.clone()
      else:
          mask_bias = None
      mask = {"weight_mask": mask_weight, "bias_mask": mask_bias}
  
      num_total = weight.size(0)
      num_prune = int(num_total * sparsity)
      if self.preserve_round > 1:
          num_preserve = num_total - num_prune
          num_preserve = int(
              math.ceil(num_preserve * 1.0 / self.preserve_round)
              * self.preserve_round
          )
          if num_preserve > num_total:
              num_preserve = int(
                  math.floor(num_total * 1.0 / self.preserve_round)
                  * self.preserve_round
              )
          num_prune = num_total - num_preserve
      # weight*mask_weight: apply base mask for iterative pruning
      return mask, weight * mask_weight, num_prune
  
imports: import logging
  import math
  import numpy
  import torch
  from .weight_masker import WeightMasker
label_desc: Use image node_id 3 for calling the StructuredWeightMasker obj's underlying member method code with example usage: obj._get_current_state(sparsity, wrapper, wrapper_idx) and returns: mask,  unknown,  num_prune