File: test_lexsort.py

package info (click to toggle)
pytorch-geometric 2.6.1-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,904 kB
  • sloc: python: 127,155; sh: 338; cpp: 27; makefile: 18; javascript: 16
file content (11 lines) | stat: -rw-r--r-- 269 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
import numpy as np
import torch

from torch_geometric.utils import lexsort


def test_lexsort():
    keys = [torch.randn(100) for _ in range(3)]

    expected = np.lexsort([key.numpy() for key in keys])
    assert torch.equal(lexsort(keys), torch.from_numpy(expected))