class_docstr: Prune to an exact pruning level specification
  
  Attributes
  ----------
  mask_dict : dict
      Dictionary for saving masks, `key` should be layer name and
      `value` should be a tensor which has the same shape with layer's weight
docstr: Export pruned model weights, masks and onnx model(optional)
  
  Parameters
  ----------
  model_path : str
      path to save pruned model state_dict
  mask_path : str
      (optional) path to save mask dict
  onnx_path : str
      (optional) path to save onnx model
  input_shape : list or tuple
      input shape to onnx model
  device : torch.device
      device of the model, used to place the dummy input tensor for exporting onnx file.
      the tensor is placed on cpu if ```device``` is None
docstr_tok: ["Export","pruned","model","weights",",","masks","and","onnx","model","(","optional",")","Parameters","--","--","--","--","--","model_path",":","str","path","to","save","pruned","model","state_dict","mask_path",":","str","(","optional",")","path","to","save","mask","dict","onnx_path",":","str","(","optional",")","path","to","save","onnx","model","input_shape",":","list","or","tuple","input","shape","to","onnx","model","device",":","torch.device","device","of","the","model",",","used","to","place","the","dummy","input","tensor","for","exporting","onnx","file",".","the","tensor","is","placed","on","cpu","if","``","`","device","``","`","is","None"]
code: def export_model(
      self,
      model_path,
      mask_path=None,
      onnx_path=None,
      input_shape=None,
      device=None,
  ):
      """
      Export pruned model weights, masks and onnx model(optional)
  
      Parameters
      ----------
      model_path : str
          path to save pruned model state_dict
      mask_path : str
          (optional) path to save mask dict
      onnx_path : str
          (optional) path to save onnx model
      input_shape : list or tuple
          input shape to onnx model
      device : torch.device
          device of the model, used to place the dummy input tensor for exporting onnx file.
          the tensor is placed on cpu if ```device``` is None
      """
      assert model_path is not None, "model_path must be specified"
  
      self._unwrap_model()  # used for generating correct state_dict name without wrapper state
      mask_dict = self.get_mask_dict()
  
      torch.save(self.bound_model.state_dict(), model_path)
      _logger.info("Model state_dict saved to %s", model_path)
      if mask_path is not None:
          torch.save(mask_dict, mask_path)
          _logger.info("Mask dict saved to %s", mask_path)
      if onnx_path is not None:
          assert (
              input_shape is not None
          ), "input_shape must be specified to export onnx model"
          # input info needed
          if device is None:
              device = torch.device("cpu")
          input_data = torch.Tensor(*input_shape)
          torch.onnx.export(
              self.bound_model, input_data.to(device), onnx_path
          )
          _logger.info(
              "Model in onnx with input shape %s saved to %s",
              input_data.shape,
              onnx_path,
          )
  
      self._wrap_model()
  
imports: import types
  import logging
  import torch
  from .None import default_layers
label_desc: Use image node_id 7 for calling the Pruner obj's underlying member method code with example usage: obj.export_model(model_path, mask_path, onnx_path, input_shape, device) without return types