class_docstr: Base class for pruning algorithms.
  
  End users should use ``compress`` and callback APIs (WIP) to prune their models.
  
  The underlying model is instrumented upon initialization of pruner object.
  So if you want to pre-train the model, train it before creating pruner object.
  
  The compressed model can only execute in eager mode.
  
  Algorithm developers should override ``calc_masks`` method to specify pruning strategy.
  
  Parameters
  ----------
  model : tf.keras.Model
      The user model to prune.
  config_list : list of JSON object
      User configuration. The format is detailed in tutorial.
class_docstr_tok: ["Base","class","for","pruning","algorithms",".","End","users","should","use","``","compress","``","and","callback","APIs","(","WIP",")","to","prune","their","models",".","The","underlying","model","is","instrumented","upon","initialization","of","pruner","object",".","So","if","you","want","to","pre-train","the","model",",","train","it","before","creating","pruner","object",".","The","compressed","model","can","only","execute","in","eager","mode",".","Algorithm","developers","should","override","``","calc_masks","``","method","to","specify","pruning","strategy",".","Parameters","--","--","--","--","--","model",":","tf.keras.Model","The","user","model","to","prune",".","config_list",":","list","of","JSON","object","User","configuration",".","The","format","is","detailed","in","tutorial","."]
docstr: Abstract method to be overridden by algorithm. End users should ignore it.
  
  If the callback is set up, this method will be invoked at end of each training minibatch.
  If not, it will only be called when end user invokes ``compress``.
  
  Parameters
  ----------
  wrapper : PrunerLayerWrapper
      The instrumented layer.
  **kwargs
      Reserved for forward compatibility.
  
  Returns
  -------
  dict of (str, tf.Tensor), or None
      The key is weight ``Variable``'s name. The value is a mask ``Tensor`` of weight's shape and dtype.
      If a weight's key does not appear in the return value, that weight will not be pruned.
      Returning ``None`` means the mask is not changed since last time.
      Weight names are globally unique, e.g. `model/conv_1/kernel:0`.
docstr_tok: ["Abstract","method","to","be","overridden","by","algorithm",".","End","users","should","ignore","it",".","If","the","callback","is","set","up",",","this","method","will","be","invoked","at","end","of","each","training","minibatch",".","If","not",",","it","will","only","be","called","when","end","user","invokes","``","compress","``",".","Parameters","--","--","--","--","--","wrapper",":","PrunerLayerWrapper","The","instrumented","layer",".","*","*","kwargs","Reserved","for","forward","compatibility",".","Returns","--","--","--","-","dict","of","(","str",",","tf.Tensor",")",",","or","None","The","key","is","weight","``","Variable","``","'s","name",".","The","value","is","a","mask","``","Tensor","``","of","weight","'s","shape","and","dtype",".","If","a","weight","'s","key","does","not","appear","in","the","return","value",",","that","weight","will","not","be","pruned",".","Returning","``","None","``","means","the","mask","is","not","changed","since","last","time",".","Weight","names","are","globally","unique",",","e.g",".","`","model\/conv_1\/kernel:0","`","."]
code: def calc_masks(self, wrapper, **kwargs):
      """
      Abstract method to be overridden by algorithm. End users should ignore it.
  
      If the callback is set up, this method will be invoked at end of each training minibatch.
      If not, it will only be called when end user invokes ``compress``.
  
      Parameters
      ----------
      wrapper : PrunerLayerWrapper
          The instrumented layer.
      **kwargs
          Reserved for forward compatibility.
  
      Returns
      -------
      dict of (str, tf.Tensor), or None
          The key is weight ``Variable``'s name. The value is a mask ``Tensor`` of weight's shape and dtype.
          If a weight's key does not appear in the return value, that weight will not be pruned.
          Returning ``None`` means the mask is not changed since last time.
          Weight names are globally unique, e.g. `model/conv_1/kernel:0`.
      """
      # TODO: maybe it should be able to calc on weight-granularity, beside from layer-granularity
      raise NotImplementedError("Pruners must overload calc_masks()")
  
file_path: auptimizer/src/aup/compression/tensorflow/compressor.py
imports: import logging
  from .None import default_layers
label_desc: Use image node_id 3 for calling the Pruner obj's underlying member method code with example usage: obj.calc_masks(wrapper) without return types