code: def test_group_argsort(num_groups, descending, device):
      src = torch.randn(20, device=device)
      index = torch.randint(0, num_groups, (20,), device=device)
  
      out = group_argsort(
          src, index, 0, num_groups, descending=descending
      )
  
      expected = torch.empty_like(index)
      for i in range(num_groups):
          mask = index == i
          tmp = src[mask].argsort(descending=descending)
          perm = torch.empty_like(tmp)
          perm[tmp] = torch.arange(tmp.numel(), device=device)
          expected[mask] = perm
  
      assert torch.equal(out, expected)
  
      empty_tensor = torch.tensor([], device=device)
      out = group_argsort(empty_tensor, empty_tensor)
      assert out.numel() == 0
  
file_path: pytorch_geometric/test/utils/test_scatter.py
imports: from itertools import product
  import pytest
  import torch
  import torch_geometric.typing
  from torch_geometric.profile import benchmark
  from torch_geometric.testing import withCUDA, withPackage
  from torch_geometric.utils import group_argsort, scatter
  from torch_geometric.utils._scatter import scatter_argmax
label_desc: Use image node_id 5 for calling a global function with example usage: test_group_argsort(num_groups, descending, device) without return types