class_docstr: Implements an efficient Sparse Self Attention of Transformer layer based on `Generative Modeling with Sparse Transformers`: https://arxiv.org/abs/1904.10509
  
  For more information please see, TODO DeepSpeed Sparse Transformer.
  
  For usage example please see, TODO DeepSpeed Sparse Transformer Tutorial.
class_docstr_tok: ["Implements","an","efficient","Sparse","Self","Attention","of","Transformer","layer","based","on","`","Generative","Modeling","with","Sparse","Transformers","`",":","https",":","\/\/arxiv.org\/abs\/1904.10509","For","more","information","please","see",",","TODO","DeepSpeed","Sparse","Transformer",".","For","usage","example","please","see",",","TODO","DeepSpeed","Sparse","Transformer","Tutorial","."]
code: def get_layout(self, L):
      # if layout is never synchronized across GPUs, broadcast the layout from global rank 0
      if self._need_layout_synchronization and dist.is_initialized():
          dist.broadcast(self.master_layout, src=0)
          self._need_layout_synchronization = False
  
      if L % self.sparsity_config.block != 0:
          raise ValueError(
              f"Sequence Length, {L}, needs to be dividable by Block size {self.sparsity_config.block}!"
          )
  
      num_blocks = L // self.sparsity_config.block
      return self.master_layout[..., :num_blocks, :num_blocks].cpu()
  
file_path: H2O/h2o_flexgen/benchmark/third_party/DeepSpeed/deepspeed/ops/sparse_attention/sparse_self_attention.py
imports: import torch.nn
  import torch
  from torch import distributed
  from deepspeed.ops.sparse_attention import SparsityConfig
label_desc: Use image node_id 2 for calling the SparseSelfAttention obj's underlying member method code with example usage: obj.get_layout(L) and returns: self