class_docstr: Implementation of Lottery Tickets Pruning for PyTorch models.
  
  :param model: Model that needs to be pruned
  :type model: torch.nn.Module
  :param train_loader: Dataloader for training
  :type train_loader: torch.utils.data.DataLoader
  :param test_loader: Dataloader for validation/testing
  :type test_loader: torch.utils.data.DataLoader
  :param loss_fn: Loss function to be used for training
  :type loss_fn: torch.nn.Module
  :param device: Device used for implementation ("cpu" by default)
  :type device: torch.device
docstr: Function used for pruning
  
  :param prune_percent: Pruning percent per iteration (percentage of alive weights to zero per pruning iteration)
  :type prune_percent: int
code: def prune_model(self, prune_percent=10):
      """
      Function used for pruning
  
      :param prune_percent: Pruning percent per iteration (percentage of alive weights to zero per pruning iteration)
      :type prune_percent: int
      """
  
      for name, param in self.model.named_parameters():
          if "weight" in name:
              param_data = param.data.cpu().numpy()
              alive = param_data[np.nonzero(param_data)]
              percentile = np.percentile(abs(alive), prune_percent)
              new_param_data = np.where(
                  abs(param_data) < percentile,
                  0,
                  self.initial_state_dict[name],
              )
              param.data = torch.from_numpy(new_param_data).to(
                  param.device
              )
          if "bias" in name:
              param.data = self.initial_state_dict[name]
  
file_path: KD_Lib/KD_Lib/Pruning/lottery_tickets/lottery_tickets.py
imports: import copy
  import numpy
  import torch
  import torch.nn
  from ..common import BaseIterativePruner
label_desc: Use image node_id 2 for calling the LotteryTicketsPruner obj's underlying member method code with example usage: obj.prune_model(prune_percent) without return types