code: def do_test(self, acti, actikw):
      device = torch.device(
          "cuda" if torch.cuda.is_available() else "cpu"
      )
      model = NaiveModel(acti, actikw).to(device)
      dummy_input = torch.randn([1000, 1, 28, 28]).to(device)
  
      # Step2. Model Pruning
      config_list = [
          {"sparsity": 0.5, "op_types": ["Linear"], "op_names": ["fc1"]}
      ]
  
      pruner = L1NormPruner(model=model, config_list=config_list)
      _, masks = pruner.compress()
      pruner.unwrap_model()  # unwrap all modules to normal state
  
      # torch.manual_seed(100)
      speedup_model = ModelSpeedup(
          model, dummy_input, masks
      ).speedup_model()
      speedup_model(dummy_input)
  
      print("model before speedup", repr(model))
      # 125.49 M, 0.85M, 93.29, 1.1012
      flops, params, _ = count_flops_params(
          model, (1, 1, 28, 28), verbose=False
      )
      print(
          f"Pretrained model FLOPs {flops/1e6:.2f} M, #Params: {params/1e6:.2f}M"
      )
  
      print("model after speedup", repr(speedup_model))
      flops, params, _ = count_flops_params(
          speedup_model, dummy_input, verbose=False
      )
      print(
          f"Pruned model FLOPs {flops/1e6:.2f} M, #Params: {params/1e6:.2f}M"
      )
  
file_path: nni/test/algo/compression/pruning/test_speedup_softmax.py
imports: import unittest
  import torch
  import torch.nn.functional
  from nni.compression.utils.counter import count_flops_params
  from nni.compression.speedup import ModelSpeedup
  from nni.compression.pruning import L1NormPruner
label_desc: Use image node_id 1 for calling the SpeedupSoftmaxTestCase obj's underlying member method code with example usage: obj.do_test(acti, actikw) without return types