code: def test_metis(device, weighted):
      mat1 = torch.randn(6 * 6, device=device).view(6, 6)
      mat2 = torch.arange(6 * 6, dtype=torch.long, device=device).view(
          6, 6
      )
      mat3 = torch.ones(6 * 6, device=device).view(6, 6)
  
      vec1 = None
      vec2 = torch.rand(6, device=device)
  
      for mat, vec in product([mat1, mat2, mat3], [vec1, vec2]):
          mat = SparseTensor.from_dense(mat)
  
          _, partptr, perm = mat.partition(
              num_parts=1,
              recursive=False,
              weighted=weighted,
              node_weight=vec,
          )
          assert partptr.numel() == 2
          assert perm.numel() == 6
  
          _, partptr, perm = mat.partition(
              num_parts=2,
              recursive=False,
              weighted=weighted,
              node_weight=vec,
          )
          assert partptr.numel() == 3
          assert perm.numel() == 6
  
imports: from itertools import product
  import pytest
  import torch
  from torch_sparse.tensor import SparseTensor
  from torch_sparse.testing import devices
label_desc: Use image node_id 1 for calling a global function with example usage: test_metis(device, weighted) without return types