I GOT THE SOLUTION!
 def hook(self, model, inputs):
        with torch.no_grad():
       
            model.weight.cpu().data = model.weight.cpu().data * self.sparse_mask[self.type[model]]

or
 def hook(self, model, inputs):
        with torch.no_grad():
       
            model.weight.data = model.weight.data * self.sparse_mask[self.type[model]].cuda()