class_docstr: Specifies when to prune layer and the sparsity(%) at each training step.
  
  PruningSchedule controls pruning during training by notifying at each step
  whether the layer's weights should be pruned or not, and the sparsity(%) at
  which they should be pruned.
  
  It can be invoked as a `callable` by providing the training `step` Tensor. It
  returns a tuple of bool and float tensors.
  
  ```python
    should_prune, sparsity = pruning_schedule(step)
  ```
  
  You can inherit this class to write your own custom pruning schedule.
class_docstr_tok: ["Specifies","when","to","prune","layer","and","the","sparsity","(","%",")","at","each","training","step",".","PruningSchedule","controls","pruning","during","training","by","notifying","at","each","step","whether","the","layer","'s","weights","should","be","pruned","or","not",",","and","the","sparsity","(","%",")","at","which","they","should","be","pruned",".","It","can","be","invoked","as","a","`","callable","`","by","providing","the","training","`","step","`","Tensor",".","It","returns","a","tuple","of","bool","and","float","tensors",".","``","`","python","should_prune",",","sparsity","=","pruning_schedule","(","step",")","``","`","You","can","inherit","this","class","to","write","your","own","custom","pruning","schedule","."]
docstr: Checks if pruning should be applied in the current training step.
  
  Pruning should only occur within the [`begin_step`, `end_step`] range every
  `frequency` number of steps.
  
  Args:
    step: Current training step.
    begin_step: Step at which to begin pruning.
    end_step: Step at which to end pruning.
    frequency: Only apply pruning every `frequency` steps.
  
  Returns:
    True/False, if pruning should be applied in current step.
docstr_tok: ["Checks","if","pruning","should","be","applied","in","the","current","training","step",".","Pruning","should","only","occur","within","the","[","`","begin_step","`",",","`","end_step","`","]","range","every","`","frequency","`","number","of","steps",".","Args",":","step",":","Current","training","step",".","begin_step",":","Step","at","which","to","begin","pruning",".","end_step",":","Step","at","which","to","end","pruning",".","frequency",":","Only","apply","pruning","every","`","frequency","`","steps",".","Returns",":","True\/False",",","if","pruning","should","be","applied","in","current","step","."]
code: def _should_prune_in_step(
      self, step, begin_step, end_step, frequency
  ):
      """Checks if pruning should be applied in the current training step.
  
      Pruning should only occur within the [`begin_step`, `end_step`] range every
      `frequency` number of steps.
  
      Args:
        step: Current training step.
        begin_step: Step at which to begin pruning.
        end_step: Step at which to end pruning.
        frequency: Only apply pruning every `frequency` steps.
  
      Returns:
        True/False, if pruning should be applied in current step.
      """
      is_in_pruning_range = tf.math.logical_and(
          tf.math.greater_equal(step, begin_step),
          # If end_pruning_step is negative, keep pruning forever!
          tf.math.logical_or(
              tf.math.less_equal(step, end_step),
              tf.math.less(end_step, 0),
          ),
      )
  
      is_pruning_turn = tf.math.equal(
          tf.math.floormod(
              tf.math.subtract(step, begin_step), frequency
          ),
          0,
      )
  
      return tf.math.logical_and(is_in_pruning_range, is_pruning_turn)
  
imports: import abc
  import six
  import tensorflow
label_desc: Use image node_id 1 for calling the PruningSchedule obj's underlying member method code with example usage: obj._should_prune_in_step(step, begin_step, end_step, frequency) and returns: tf