class_docstr: Instrumented TF layer.
  
  Wrappers will be passed to pruner's ``calc_masks`` API,
  and the pruning algorithm should use wrapper's attributes to calculate masks.
  
  Once instrumented, underlying layer's weights will get **modified** by masks before forward pass.
  
  Attributes
  ----------
  layer_info : LayerInfo
      All static information of the original layer.
  layer : tf.keras.layers.Layer
      The original layer.
  config : JSON object
      Selected configuration. The format is detailed in tutorial.
  pruner : Pruner
      Bound pruner object.
  masks : dict of (str, tf.Tensor)
      Current masks. The key is weight's name and the value is mask tensor.
      On initialization, `masks` is an empty dict, which means no weight is pruned.
      Afterwards, `masks` is the last return value of ``Pruner.calc_masks``.
      See ``Pruner.calc_masks`` for details.
class_docstr_tok: ["Instrumented","TF","layer",".","Wrappers","will","be","passed","to","pruner","'s","``","calc_masks","``","API",",","and","the","pruning","algorithm","should","use","wrapper","'s","attributes","to","calculate","masks",".","Once","instrumented",",","underlying","layer","'s","weights","will","get","*","*","modified","*","*","by","masks","before","forward","pass",".","Attributes","--","--","--","--","--","layer_info",":","LayerInfo","All","static","information","of","the","original","layer",".","layer",":","tf.keras.layers.Layer","The","original","layer",".","config",":","JSON","object","Selected","configuration",".","The","format","is","detailed","in","tutorial",".","pruner",":","Pruner","Bound","pruner","object",".","masks",":","dict","of","(","str",",","tf.Tensor",")","Current","masks",".","The","key","is","weight","'s","name","and","the","value","is","mask","tensor",".","On","initialization",",","`","masks","`","is","an","empty","dict",",","which","means","no","weight","is","pruned",".","Afterwards",",","`","masks","`","is","the","last","return","value","of","``","Pruner.calc_masks","``",".","See","``","Pruner.calc_masks","``","for","details","."]
code: def call(self, *inputs):
      new_weights = []
      for weight in self.layer.weights:
          mask = self.masks.get(weight.name)
          if mask is not None:
              new_weights.append(tf.math.multiply(weight, mask))
          else:
              new_weights.append(weight)
      if new_weights and not hasattr(new_weights[0], "numpy"):
          raise RuntimeError(
              "NNI: Compressed model can only run in eager mode"
          )
      self.layer.set_weights([weight.numpy() for weight in new_weights])
      return self.layer(*inputs)
  
file_path: auptimizer/src/aup/compression/tensorflow/compressor.py
imports: import logging
  from .None import default_layers
label_desc: Use image node_id 2 for calling the PrunerLayerWrapper obj's underlying member method code with example usage: obj.call() and returns: self