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)
pre_mask = torch.tensor([i % 2 for i in range(100)], dtype=float).view(10, 10)
block_l1_norms = param.new_zeros(param.shape)
// loop-based implementation to compute blockwise l1norm
abs_vals = []
for i in range(10):
After Change
param = torch.tensor([i for i in range(100)], dtype=float).view(10, 10)
param = param - param.new_ones(param.shape) * 50
pre_mask = param.new_zeros(param.shape)
pre_mask[5:, :] = torch.ones(pre_mask[5:, :].shape)
block_l1_norms = param.new_zeros(param.shape)
// loop-based implementation to compute blockwise l1norm
abs_vals = []
for i in range(10):