:py:mod:`neural_compressor.compression.pruner` ============================================== .. py:module:: neural_compressor.compression.pruner .. autoapi-nested-parse:: Pruning init. Subpackages ----------- .. toctree:: :titlesonly: :maxdepth: 3 model_slim/index.rst patterns/index.rst pruners/index.rst wanda/index.rst Submodules ---------- .. toctree:: :titlesonly: :maxdepth: 1 criteria/index.rst pruning/index.rst regs/index.rst schedulers/index.rst tf_criteria/index.rst utils/index.rst Package Contents ---------------- Functions ~~~~~~~~~ .. autoapisummary:: neural_compressor.compression.pruner.save neural_compressor.compression.pruner.prepare_pruning .. py:function:: save(obj: object, f, pickle_module=None, pickle_protocol=None, _use_new_zipfile_serialization=None) A rewrite function for torch save. :param obj: :param f: :param pickle_module: :param pickle_protocol: :param _use_new_zipfile_serialization: :return: .. py:function:: prepare_pruning(model, config, optimizer=None, dataloader=None, loss_func=None, framework='pytorch', device: str = None) Get registered pruning class, wrapper the model and optimizer to support all the pruning functionality. Get a pruning object from PRUNINGS. :param modules: A dict {"module_name": Tensor} that stores the pruning modules' weights. :param config: A config dict object that contains the pruners information. :returns: A pruning object. Raises: AssertionError: Currently only support prunings that have been registered in PRUNINGS.