class_docstr: Specifies what layers to prune in the model.
  
  PruningPolicy controls application of `PruneLowMagnitude` wrapper on per-layer
  basis and checks that the model contains only supported layers.
  PruningPolicy works together with `prune_low_magnitude` through which it
  provides fine-grained control over pruning in the model.
  
  ```python
  pruning_params = {
      'pruning_schedule': ConstantSparsity(0.5, 0),
      'block_size': (1, 1),
      'block_pooling_type': 'AVG'
  }
  
  model = prune_low_magnitude(
      keras.Sequential([
          layers.Dense(10, activation='relu', input_shape=(100,)),
          layers.Dense(2, activation='sigmoid')
      ]),
      pruning_policy=PruneForLatencyOnXNNPack(),
      **pruning_params)
  ```
  
  You can inherit this class to write your own custom pruning policy.
  
  The API is experimental and is subject to change.
class_docstr_tok: ["Specifies","what","layers","to","prune","in","the","model",".","PruningPolicy","controls","application","of","`","PruneLowMagnitude","`","wrapper","on","per-layer","basis","and","checks","that","the","model","contains","only","supported","layers",".","PruningPolicy","works","together","with","`","prune_low_magnitude","`","through","which","it","provides","fine-grained","control","over","pruning","in","the","model",".","``","`","python","pruning_params","=","{","'pruning_schedule","'",":","ConstantSparsity","(","0.5",",","0",")",",","'block_size","'",":","(","1",",","1",")",",","'block_pooling_type","'",":","'AVG'","}","model","=","prune_low_magnitude","(","keras.Sequential","(","[","layers.Dense","(","10",",","activation='relu","'",",","input_shape=","(","100",",",")",")",",","layers.Dense","(","2",",","activation='sigmoid","'",")","]",")",",","pruning_policy=PruneForLatencyOnXNNPack","(",")",",","*","*","pruning_params",")","``","`","You","can","inherit","this","class","to","write","your","own","custom","pruning","policy",".","The","API","is","experimental","and","is","subject","to","change","."]
docstr: Checks if pruning wrapper should be applied for the current layer.
  
  Args:
    layer: Current layer in the model.
  
  Returns:
    True/False, whether the pruning wrapper should be applied for the layer.
docstr_tok: ["Checks","if","pruning","wrapper","should","be","applied","for","the","current","layer",".","Args",":","layer",":","Current","layer","in","the","model",".","Returns",":","True\/False",",","whether","the","pruning","wrapper","should","be","applied","for","the","layer","."]
code: def allow_pruning(self, layer):
      """Checks if pruning wrapper should be applied for the current layer.
  
      Args:
        layer: Current layer in the model.
  
      Returns:
        True/False, whether the pruning wrapper should be applied for the layer.
      """
      raise NotImplementedError
  
file_path: model-optimization/tensorflow_model_optimization/python/core/sparsity/keras/pruning_policy.py
imports: import abc
  import tensorflow
  from tensorflow_model_optimization.python.core.quantization.keras import utils
  from tensorflow_model_optimization.python.core.sparsity.keras import pruning_wrapper
label_desc: Use image node_id 1 for calling the PruningPolicy obj's underlying member method code with example usage: obj.allow_pruning(layer) without return types