class_docstr: Parameters
  ----------
  model : torch.nn.Module
      Model to be pruned.
  config_list : listlist
      Supported keys:
          - initial_sparsity: This is to specify the sparsity when compressor starts to compress.
          - final_sparsity: This is to specify the sparsity when compressor finishes to compress.
          - start_epoch: This is to specify the epoch number when compressor starts to compress, default start from epoch 0.
          - end_epoch: This is to specify the epoch number when compressor finishes to compress.
          - frequency: This is to specify every *frequency* number epochs compressor compress once, default frequency=1.
  optimizer: torch.optim.Optimizer
      Optimizer used to train model.
  pruning_algorithm: str
      Algorithms being used to prune model,
      choose from `['level', 'slim', 'l1', 'l2', 'fpgm', 'taylorfo', 'apoz', 'mean_activation']`, by default `level`
class_docstr_tok: ["Parameters","--","--","--","--","--","model",":","torch.nn.Module","Model","to","be","pruned",".","config_list",":","listlist","Supported","keys",":","-","initial_sparsity",":","This","is","to","specify","the","sparsity","when","compressor","starts","to","compress",".","-","final_sparsity",":","This","is","to","specify","the","sparsity","when","compressor","finishes","to","compress",".","-","start_epoch",":","This","is","to","specify","the","epoch","number","when","compressor","starts","to","compress",",","default","start","from","epoch","0",".","-","end_epoch",":","This","is","to","specify","the","epoch","number","when","compressor","finishes","to","compress",".","-","frequency",":","This","is","to","specify","every","*","frequency","*","number","epochs","compressor","compress","once",",","default","frequency=1",".","optimizer",":","torch.optim.Optimizer","Optimizer","used","to","train","model",".","pruning_algorithm",":","str","Algorithms","being","used","to","prune","model",",","choose","from","`","[","'level","'",",","'slim","'",",","'l1","'",",","'l2","'",",","'fpgm","'",",","'taylorfo","'",",","'apoz","'",",","'mean_activation","'","]","`",",","by","default","`","level","`"]
code: def __init__(
      self, model, config_list, optimizer, pruning_algorithm="level"
  ):
      super().__init__(model, config_list, optimizer)
      assert isinstance(
          optimizer, torch.optim.Optimizer
      ), "AGP pruner is an iterative pruner, please pass optimizer of the model to it"
      self.masker = MASKER_DICT[pruning_algorithm](model, self)
  
      self.now_epoch = 0
      self.set_wrappers_attribute("if_calculated", False)
  
file_path: auptimizer/src/aup/compression/torch/pruning/agp.py
imports: import logging
  import torch
  from schema import And, Optional
  from .constants import MASKER_DICT
  from ..utils.config_validation import CompressorSchema
  from ..compressor import Pruner
label_desc: Use image node_id 1 to create a new AGPPruner object from inherited base classes: Pruner with example: obj = AGPPruner(model, config_list, optimizer, pruning_algorithm)