code: def test_param_mask(self):
      sparsity = 0.6
      block_sz = 3
      blockwise_sparsifier = self._get_blockwise_sparsifier(
          block_sz, sparsity
      )
      param = torch.tensor([i for i in range(100)], dtype=float).view(
          10, 10
      )
      param = param - param.new_ones(param.shape) * 50
      block_l1_norms = param.new_zeros(param.shape)
      # loop-based implementation to compute blockwise l1norm
      abs_vals = []
      for i in range(10):
          for j in range(0, 10, block_sz):
              block_l1_norms[i, j : j + block_sz] = torch.sum(
                  torch.abs(param[i, j : j + block_sz])
              )
              abs_vals.append(
                  torch.sum(torch.abs(param[i, j : j + block_sz]))
              )
  
      nnz = math.ceil(100 * (1 - sparsity))
      nnz_blocks = math.ceil(nnz / block_sz)
      abs_vals.sort(reverse=True)
      threshold = abs_vals[nnz_blocks - 1]
      true_mask = (block_l1_norms >= threshold).to(param.dtype)
      mask = blockwise_sparsifier._compute_param_mask(param)
      diff = torch.sum(torch.abs(mask - true_mask)).item()
      self.assertTrue(diff <= 0.00000001)
  
file_path: pytext/pytext/optimizer/sparsifiers/tests/sparsifier_test.py
imports: import math
  import unittest
  import torch
  from pytext.optimizer.sparsifiers.blockwise_sparsifier import BlockwiseMagnitudeSparsifier
label_desc: Use image node_id 3 for calling the TestSparsifier obj's underlying member method code with example usage: obj.test_param_mask() without return types