class_docstr: Abstract Configuration class to store `sparsity configuration of a self attention layer`.
  It contains shared property of different block-sparse sparsity patterns. However, each class
  needs to extend it based on required property and functionality.
class_docstr_tok: ["Abstract","Configuration","class","to","store","`","sparsity","configuration","of","a","self","attention","layer","`",".","It","contains","shared","property","of","different","block-sparse","sparsity","patterns",".","However",",","each","class","needs","to","extend","it","based","on","required","property","and","functionality","."]
docstr: Create layout tensor for the given sequence length
  Arguments:
       seq_len: required: an integer determining number of attention heads of the layer.
  Return:
       layout: a tensor of dimension (num_heads, num_blocks, num_blocks) for sparsity layout
          of all head; initialized with zero
docstr_tok: ["Create","layout","tensor","for","the","given","sequence","length","Arguments",":","seq_len",":","required",":","an","integer","determining","number","of","attention","heads","of","the","layer",".","Return",":","layout",":","a","tensor","of","dimension","(","num_heads",",","num_blocks",",","num_blocks",")","for","sparsity","layout","of","all","head",";","initialized","with","zero"]
code: def setup_layout(self, seq_len):
      """Create layout tensor for the given sequence length
      Arguments:
           seq_len: required: an integer determining number of attention heads of the layer.
      Return:
           layout: a tensor of dimension (num_heads, num_blocks, num_blocks) for sparsity layout
              of all head; initialized with zero
      """
  
      if seq_len % self.block_size != 0:
          raise ValueError(
              f"Sequence Length, {seq_len}, needs to be dividable by Block size {self.block_size}!"
          )
      num_blocks = seq_len // self.block_size
      # TODO Currently we allocate layout per head; needs to be updated if heads share a single layout.
      layout = torch.zeros(
          (self.num_heads, num_blocks, num_blocks), dtype=torch.int64
      )
      return layout
  
imports: import random
  import torch
label_desc: Use image node_id 2 for calling the SparsityConfig obj's underlying member method code with example usage: obj.setup_layout(seq_len) and returns: layout