class_docstr: Implementation of magnitude-based weight pruning.
class_docstr_tok: ["Implementation","of","magnitude-based","weight","pruning","."]
docstr: The logic for magnitude-based pruning weight tensors.
  
  Args:
    training_step_fn: A callable that returns the training step.
    pruning_vars: A list of (weight, mask, threshold) tuples
    pruning_schedule: A `PruningSchedule` object that controls pruning rate
      throughout training.
    block_size: The dimensions (height, weight) for the block sparse pattern
      in rank-2 weight tensors.
    block_pooling_type: (optional) The function to use to pool weights in the
      block. Must be 'AVG' or 'MAX'.
    sparsity_m_by_n: default None, otherwise a tuple of 2 integers, indicates
      pruning with m_by_n sparsity, e.g., (2, 4): 2 zeros out of 4 consecutive
      elements. It check whether we can do pruning with m_by_n sparsity.
docstr_tok: ["The","logic","for","magnitude-based","pruning","weight","tensors",".","Args",":","training_step_fn",":","A","callable","that","returns","the","training","step",".","pruning_vars",":","A","list","of","(","weight",",","mask",",","threshold",")","tuples","pruning_schedule",":","A","`","PruningSchedule","`","object","that","controls","pruning","rate","throughout","training",".","block_size",":","The","dimensions","(","height",",","weight",")","for","the","block","sparse","pattern","in","rank-2","weight","tensors",".","block_pooling_type",":","(","optional",")","The","function","to","use","to","pool","weights","in","the","block",".","Must","be","'AVG","'","or","'MAX","'",".","sparsity_m_by_n",":","default","None",",","otherwise","a","tuple","of","2","integers",",","indicates","pruning","with","m_by_n","sparsity",",","e.g.",",","(","2",",","4",")",":","2","zeros","out","of","4","consecutive","elements",".","It","check","whether","we","can","do","pruning","with","m_by_n","sparsity","."]
code: def __init__(
      self,
      training_step_fn,
      pruning_vars,
      pruning_schedule,
      block_size,
      block_pooling_type,
      sparsity_m_by_n=None,
  ):
      """The logic for magnitude-based pruning weight tensors.
  
      Args:
        training_step_fn: A callable that returns the training step.
        pruning_vars: A list of (weight, mask, threshold) tuples
        pruning_schedule: A `PruningSchedule` object that controls pruning rate
          throughout training.
        block_size: The dimensions (height, weight) for the block sparse pattern
          in rank-2 weight tensors.
        block_pooling_type: (optional) The function to use to pool weights in the
          block. Must be 'AVG' or 'MAX'.
        sparsity_m_by_n: default None, otherwise a tuple of 2 integers, indicates
          pruning with m_by_n sparsity, e.g., (2, 4): 2 zeros out of 4 consecutive
          elements. It check whether we can do pruning with m_by_n sparsity.
      """
      self._pruning_vars = pruning_vars
      self._pruning_schedule = pruning_schedule
      self._block_size = list(block_size)
      self._block_pooling_type = block_pooling_type
      self._sparsity_m_by_n = sparsity_m_by_n
      self._validate_block()
  
      # Training step
      self._step_fn = training_step_fn
  
      self._validate_block()
  
file_path: model-optimization/tensorflow_model_optimization/python/core/sparsity/keras/pruning_impl.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import tensorflow
  from tensorflow_model_optimization.python.core.keras import compat
  from tensorflow_model_optimization.python.core.sparsity.keras import pruning_utils
label_desc: Use image node_id 1 to create a new Pruning object from inherited base classes: object with example: obj = Pruning(training_step_fn, pruning_vars, pruning_schedule, block_size, block_pooling_type, sparsity_m_by_n)