Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
torch-sparse
Commits
0802c75b
Commit
0802c75b
authored
Jul 14, 2021
by
rusty1s
Browse files
remove test
parent
2af23342
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
40 deletions
+0
-40
test/test_hgt_sample.py
test/test_hgt_sample.py
+0
-40
No files found.
test/test_hgt_sample.py
deleted
100644 → 0
View file @
2af23342
# from typing import Dict, List
import
torch
# from torch import Tensor
import
torch_sparse
# noqa
def
test_hgt_sample
():
rowptr
=
torch
.
tensor
([
0
,
1
,
3
,
4
])
# row = torch.tensor([0, 1, 1, 2])
col
=
torch
.
tensor
([
1
,
0
,
2
,
1
])
# _ = SparseTensor(row=row, col=col, sparse_sizes=(6, 6))
rowptr_dict
=
{
'paper__to__paper'
:
rowptr
}
col_dict
=
{
'paper__to__paper'
:
col
}
node_idx_dict
=
{
'paper'
:
torch
.
arange
(
rowptr
.
numel
()
-
1
)}
num_neighbors_dict
=
{
'paper__to__paper'
:
[
5
,
5
]}
num_hops
=
2
# nid = torch.tensor([0, 1])
fn
=
torch
.
ops
.
torch_sparse
.
hgt_sample
# print(fn)
# fn(rowptr_dict, col_dict, node_idx_dict, num_neighbors_dict, num_hops)
fn
(
rowptr_dict
,
col_dict
,
node_idx_dict
,
num_neighbors_dict
,
num_hops
)
# out = fn(rowptr, col, nid, 1, 3, False)
# rowptr, col, nid, eid, ptr, root_n_id = out
# assert nid.tolist() == [0, 1, 2, 3, 0, 1, 2]
# assert rowptr.tolist() == [0, 3, 5, 7, 8, 10, 12, 14]
# # row [0, 0, 0, 1, 1, 2, 2, 3, 4, 4, 5, 5, 6, 6]
# assert col.tolist() == [1, 2, 3, 0, 2, 0, 1, 0, 5, 6, 4, 6, 4, 5]
# assert eid.tolist() == [0, 1, 2, 3, 4, 5, 6, 9, 0, 1, 3, 4, 5, 6]
# assert ptr.tolist() == [0, 4, 7]
# assert root_n_id.tolist() == [0, 5]
# import timeit
# print('Timeit', timeit.timeit(test_hgt_sample))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment