code: def prune_model(model, input_shape, prune_ratio=0.1):
      flops = paddle.flops(model, input_shape)
      pruner = FPGMFilterPruner(model, input_shape)
  
      params_sensitive = {}
      for param in model.parameters():
          if (
              "transpose" not in param.name
              and "linear" not in param.name
          ):
              # set prune ratio as 10%. The larger the value, the more convolution weights will be cropped
              params_sensitive[param.name] = prune_ratio
  
      plan = pruner.prune_vars(params_sensitive, [0])
  
      flops = paddle.flops(model, input_shape)
      return model
  
imports: import paddleslim
  import paddle
  import numpy
  from paddleslim.dygraph import FPGMFilterPruner
label_desc: Use image node_id 1 for calling a global function with example usage: prune_model(model, input_shape, prune_ratio) and returns: model