code: def test_topk_ratio():
      x = torch.tensor([2.0, 4.0, 5.0, 6.0, 2.0, 9.0])
      batch = torch.tensor([0, 0, 1, 1, 1, 1])
  
      perm1 = topk(x, 0.5, batch)
      assert perm1.tolist() == [1, 5, 3]
      assert x[perm1].tolist() == [4.0, 9.0, 6.0]
      assert batch[perm1].tolist() == [0, 1, 1]
  
      perm2 = topk(x, 2, batch)
      assert perm2.tolist() == [1, 0, 5, 3]
      assert x[perm2].tolist() == [4.0, 2.0, 9.0, 6.0]
      assert batch[perm2].tolist() == [0, 0, 1, 1]
  
      perm3 = topk(x, 3, batch)
      assert perm3.tolist() == [1, 0, 5, 3, 2]
      assert x[perm3].tolist() == [4.0, 2.0, 9.0, 6.0, 5.0]
      assert batch[perm3].tolist() == [0, 0, 1, 1, 1]
  
      if is_full_test():
          jit = torch.jit.script(topk)
          assert torch.equal(jit(x, 0.5, batch), perm1)
          assert torch.equal(jit(x, 2, batch), perm2)
          assert torch.equal(jit(x, 3, batch), perm3)
  
file_path: pytorch_geometric/test/nn/pool/select/test_select_topk.py
imports: from itertools import product
  import pytest
  import torch
  from torch_geometric.nn.pool.select import SelectOutput, SelectTopK
  from torch_geometric.nn.pool.select.topk import topk
  from torch_geometric.profile import benchmark
  from torch_geometric.testing import is_full_test
label_desc: Use image node_id 1 for calling a global function with example usage: test_topk_ratio() without return types