导入模块并准备输入特征符:
from pytorch_nndct import get_pruning_runner
# The input signature should have the same shape and dtype as the model input.
input_signature = torch.randn([1, 3, 224, 224], dtype=torch.float32)
创建迭代剪枝运行器:
runner = get_pruning_runner(model, input_signature, 'iterative')
或者单步剪枝运行器:
runner = get_pruning_runner(model, input_signature, 'one_step')