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 whether the parameters for pruning schedule are valid.
  
  Args:
    begin_step: Step at which to begin pruning.
    end_step: Step at which to end pruning. Special value of `-1` implies
      pruning can continue forever.
    frequency: Only apply pruning every `frequency` steps.
    allow_negative_1: Whether end_step is allowed to be `-1` or not.
  
  Returns:
    None
docstr_tok: ["Checks","whether","the","parameters","for","pruning","schedule","are","valid",".","Args",":","begin_step",":","Step","at","which","to","begin","pruning",".","end_step",":","Step","at","which","to","end","pruning",".","Special","value","of","`","-1","`","implies","pruning","can","continue","forever",".","frequency",":","Only","apply","pruning","every","`","frequency","`","steps",".","allow_negative_1",":","Whether","end_step","is","allowed","to","be","`","-1","`","or","not",".","Returns",":","None"]
code: def _validate_step(
      self, begin_step, end_step, frequency, allow_negative_1
  ):
      """Checks whether the parameters for pruning schedule are valid.
  
      Args:
        begin_step: Step at which to begin pruning.
        end_step: Step at which to end pruning. Special value of `-1` implies
          pruning can continue forever.
        frequency: Only apply pruning every `frequency` steps.
        allow_negative_1: Whether end_step is allowed to be `-1` or not.
  
      Returns:
        None
      """
  
      if begin_step < 0:
          raise ValueError("begin_step should be >= 0")
  
      # In cases like PolynomialDecay, continuing to prune forever does not make
      # sense. The function needs an end_step to decay the sparsity.
      if not allow_negative_1 and end_step == -1:
          raise ValueError("end_step cannot be -1.")
  
      if end_step != -1:
          if end_step < 0:
              raise ValueError("end_step can be -1 or >= 0")
          if end_step < begin_step:
              raise ValueError(
                  "begin_step should be <= end_step if end_step != -1"
              )
  
      if frequency <= 0:
          raise ValueError("frequency should be > 0")
  
imports: import abc
  import six
  import tensorflow
label_desc: Use image node_id 2 for calling the PruningSchedule obj's underlying member method code with example usage: obj._validate_step(begin_step, end_step, frequency, allow_negative_1) without return types