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
203d69f2
Commit
203d69f2
authored
Apr 13, 2020
by
bowendeng
Browse files
Merge remote-tracking branch 'origin/master'
parents
46f7e1e8
2fd3c005
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
.gitignore
.gitignore
+1
-0
test/test_metis.py
test/test_metis.py
+8
-3
No files found.
.gitignore
View file @
203d69f2
...
@@ -6,3 +6,4 @@ dist/
...
@@ -6,3 +6,4 @@ dist/
*.egg-info/
*.egg-info/
.coverage
.coverage
*.so
*.so
.idea/
\ No newline at end of file
test/test_metis.py
View file @
203d69f2
...
@@ -7,11 +7,16 @@ from .utils import devices
...
@@ -7,11 +7,16 @@ from .utils import devices
@
pytest
.
mark
.
parametrize
(
'device'
,
devices
)
@
pytest
.
mark
.
parametrize
(
'device'
,
devices
)
def
test_metis
(
device
):
def
test_metis
(
device
):
mat
=
SparseTensor
.
from_dense
(
torch
.
randn
((
6
,
6
),
device
=
device
))
weighted_
mat
=
SparseTensor
.
from_dense
(
torch
.
randn
((
6
,
6
),
device
=
device
))
mat
,
partptr
,
perm
=
mat
.
partition
(
num_parts
=
2
,
recursive
=
False
)
mat
,
partptr
,
perm
=
weighted_
mat
.
partition
(
num_parts
=
2
,
recursive
=
False
)
assert
partptr
.
numel
()
==
3
assert
partptr
.
numel
()
==
3
assert
perm
.
numel
()
==
6
assert
perm
.
numel
()
==
6
mat
,
partptr
,
perm
=
mat
.
partition
(
num_parts
=
2
,
recursive
=
True
)
mat
,
partptr
,
perm
=
weighted_mat
.
partition
(
num_parts
=
2
,
recursive
=
True
)
assert
partptr
.
numel
()
==
3
assert
perm
.
numel
()
==
6
unweighted_mat
=
SparseTensor
.
from_dense
(
torch
.
ones
((
6
,
6
),
device
=
device
))
mat
,
partptr
,
perm
=
unweighted_mat
.
partition
(
num_parts
=
2
,
recursive
=
True
)
assert
partptr
.
numel
()
==
3
assert
partptr
.
numel
()
==
3
assert
perm
.
numel
()
==
6
assert
perm
.
numel
()
==
6
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