class_docstr: L1-Norm Sparsifier
  This sparsifier computes the *L1-norm* of every sparse block and "zeroes-out" the
  ones with the lowest norm. The level of sparsity defines how many of the
  blocks is removed.
  This sparsifier is controlled by three variables:
  1. `sparsity_level` defines the number of *sparse blocks* that are zeroed-out
  2. `sparse_block_shape` defines the shape of the sparse blocks. Note that
      the sparse blocks originate at the zero-index of the tensor.
  3. `zeros_per_block` is the number of zeros that we are expecting in each
      sparse block. By default we assume that all elements within a block are
      zeroed-out. However, setting this variable sets the target number of
      zeros per block. The zeros within each block are chosen as the *smallest
      absolute values*.
  Args:
      sparsity_level: The target level of sparsity
      sparse_block_shape: The shape of a sparse block
      zeros_per_block: Number of zeros in a sparse block
  Note::
      All arguments to the DataNormSparsifier constructor are "default"
      arguments and could be overriden by the configuration provided in the
      `add_data` step.
class_docstr_tok: ["L1-Norm","Sparsifier","This","sparsifier","computes","the","*","L1-norm","*","of","every","sparse","block","and","``","zeroes-out","''","the","ones","with","the","lowest","norm",".","The","level","of","sparsity","defines","how","many","of","the","blocks","is","removed",".","This","sparsifier","is","controlled","by","three","variables",":","1",".","`","sparsity_level","`","defines","the","number","of","*","sparse","blocks","*","that","are","zeroed-out","2",".","`","sparse_block_shape","`","defines","the","shape","of","the","sparse","blocks",".","Note","that","the","sparse","blocks","originate","at","the","zero-index","of","the","tensor",".","3",".","`","zeros_per_block","`","is","the","number","of","zeros","that","we","are","expecting","in","each","sparse","block",".","By","default","we","assume","that","all","elements","within","a","block","are","zeroed-out",".","However",",","setting","this","variable","sets","the","target","number","of","zeros","per","block",".","The","zeros","within","each","block","are","chosen","as","the","*","smallest","absolute","values","*",".","Args",":","sparsity_level",":","The","target","level","of","sparsity","sparse_block_shape",":","The","shape","of","a","sparse","block","zeros_per_block",":","Number","of","zeros","in","a","sparse","block","Note",":",":","All","arguments","to","the","DataNormSparsifier","constructor","are","``","default","''","arguments","and","could","be","overriden","by","the","configuration","provided","in","the","`","add_data","`","step","."]
code: def __get_scatter_folded_mask(
      self, data, dim, indices, output_size, sparse_block_shape
  ):
      mask = torch.ones_like(data)
      mask.scatter_(dim=dim, index=indices, value=0)  # zeroing out
      mask = F.fold(
          mask,
          output_size=output_size,
          kernel_size=sparse_block_shape,
          stride=sparse_block_shape,
      )
      mask = mask.to(torch.int8)
      return mask
  
file_path: pytorch/torch/ao/pruning/_experimental/data_sparsifier/data_norm_sparsifier.py
imports: import torch
  from torch.nn import functional
  from functools import reduce
  from typing import Any, List, Optional, Tuple
  from .base_data_sparsifier import BaseDataSparsifier
  import operator
label_desc: Use image node_id 2 for calling the DataNormSparsifier obj's underlying member method code with example usage: obj.__get_scatter_folded_mask(data, dim, indices, output_size, sparse_block_shape) and returns: mask