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
a3afa1dd
Commit
a3afa1dd
authored
Dec 22, 2019
by
rusty1s
Browse files
test coalesce
parent
f3469f1a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletion
+13
-1
test/test_storage.py
test/test_storage.py
+13
-1
No files found.
test/test_storage.py
View file @
a3afa1dd
...
@@ -130,4 +130,16 @@ def test_utility(dtype, device):
...
@@ -130,4 +130,16 @@ def test_utility(dtype, device):
@
pytest
.
mark
.
parametrize
(
'dtype,device'
,
product
(
dtypes
,
devices
))
@
pytest
.
mark
.
parametrize
(
'dtype,device'
,
product
(
dtypes
,
devices
))
def
test_coalesce
(
dtype
,
device
):
def
test_coalesce
(
dtype
,
device
):
pass
index
=
tensor
([[
0
,
0
,
0
,
1
,
1
],
[
0
,
1
,
1
,
0
,
1
]],
torch
.
long
,
device
)
value
=
tensor
([
1
,
1
,
1
,
3
,
4
],
dtype
,
device
)
storage
=
SparseStorage
(
index
,
value
)
assert
storage
.
index
.
tolist
()
==
index
.
tolist
()
assert
storage
.
value
.
tolist
()
==
value
.
tolist
()
assert
not
storage
.
is_coalesced
()
storage
=
storage
.
coalesce
()
assert
storage
.
is_coalesced
()
assert
storage
.
index
.
tolist
()
==
[[
0
,
0
,
1
,
1
],
[
0
,
1
,
0
,
1
]]
assert
storage
.
value
.
tolist
()
==
[
1
,
2
,
3
,
4
]
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