code: def layout_to_pattern(layout: torch.Tensor, block_size: int):
      r"""
      create a pattern of shape [heads, seq, seq] out of a blocksparse
      layout of shape [heads, seq/block_size, seq/block_size]
      """
      return torch.kron(layout, torch.ones(block_size, block_size))
  
imports: import math
  from typing import List
  import numpy
  import torch
  from xformers.components.attention.sparsity_config import BigBirdSparsityConfig, BSLongformerSparsityConfig, FixedSparsityConfig, VariableSparsityConfig
label_desc: Use image node_id 26 for calling a global function with example usage: layout_to_pattern(layout, block_size) and returns: torch