code: def sparsify_tensor(x, mask, block):
      ret = torch.empty(
          (x.size(0), mask.sum(), block, block),
          dtype=x.dtype,
          device=x.device,
      )
      for idx, (h, i, j) in enumerate(
          zip(*mask.nonzero(as_tuple=True))
      ):
          ret[:, idx, :, :] = x[
              :,
              h,
              i * block : (i + 1) * block,
              j * block : (j + 1) * block,
          ]
      return ret
  
file_path: triton/python/test/unit/operators/test_blocksparse.py
imports: import pytest
  import torch
  import triton
  import triton.ops
label_desc: Use image node_id 1 for calling a global function with example usage: sparsify_tensor(x, mask, block) and returns: ret