code: def test_sddmm_sputnik(device):
      B, L, M, K = 8, 30, 16, 32
      prob = 0.5
      a = torch.rand(B, L, K, device=device)
      b = torch.rand(B, M, K, device=device).transpose(-2, -1)
      mask = _create_random_sparsity(
          torch.ones(B, L, M, dtype=torch.bool, device=device), prob
      )
  
      mask_csr = xformers.components.attention.core.SparseCS(
          mask, device
      )
  
      fn = xformers.components.attention.core._matmul_with_mask
  
      mask = mask.to_sparse()
  
      res = fn(a, b, mask_csr)
      res_gt = fn(a, b, mask)
  
      res = res.to_dense()
      res_gt = res_gt.to_dense()
  
      assert res.dtype == res_gt.dtype
      assert torch.allclose(res, res_gt)
  
imports: import pytest
  import torch
  import xformers
  import xformers.components.attention.core
  from xformers.components.attention._sputnik_sparse import _csr_to_coo
  from xformers.components.attention.core import _broadcast_batch, _create_random_sparsity, _sparse_bmm
label_desc: Use image node_id 6 for calling a global function with example usage: test_sddmm_sputnik(device) without return types