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
35b09b7b
Commit
35b09b7b
authored
Jun 17, 2020
by
rusty1s
Browse files
fix device eye test
parent
d474adfa
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
test/test_eye.py
test/test_eye.py
+7
-7
No files found.
test/test_eye.py
View file @
35b09b7b
...
...
@@ -9,7 +9,7 @@ from .utils import dtypes, devices
@
pytest
.
mark
.
parametrize
(
'dtype,device'
,
product
(
dtypes
,
devices
))
def
test_eye
(
dtype
,
device
):
mat
=
SparseTensor
.
eye
(
3
,
dtype
=
dtype
,
device
=
device
)
assert
mat
.
storage
.
col
().
device
==
device
assert
mat
.
device
()
==
device
assert
mat
.
storage
.
sparse_sizes
()
==
(
3
,
3
)
assert
mat
.
storage
.
row
().
tolist
()
==
[
0
,
1
,
2
]
assert
mat
.
storage
.
rowptr
().
tolist
()
==
[
0
,
1
,
2
,
3
]
...
...
@@ -18,8 +18,8 @@ def test_eye(dtype, device):
assert
mat
.
storage
.
value
().
dtype
==
dtype
assert
mat
.
storage
.
num_cached_keys
()
==
0
mat
=
SparseTensor
.
eye
(
3
,
has_value
=
False
)
assert
mat
.
storage
.
col
().
device
==
device
mat
=
SparseTensor
.
eye
(
3
,
has_value
=
False
,
device
=
device
)
assert
mat
.
device
()
==
device
assert
mat
.
storage
.
sparse_sizes
()
==
(
3
,
3
)
assert
mat
.
storage
.
row
().
tolist
()
==
[
0
,
1
,
2
]
assert
mat
.
storage
.
rowptr
().
tolist
()
==
[
0
,
1
,
2
,
3
]
...
...
@@ -27,8 +27,8 @@ def test_eye(dtype, device):
assert
mat
.
storage
.
value
()
is
None
assert
mat
.
storage
.
num_cached_keys
()
==
0
mat
=
SparseTensor
.
eye
(
3
,
4
,
fill_cache
=
True
)
assert
mat
.
storage
.
col
().
device
==
device
mat
=
SparseTensor
.
eye
(
3
,
4
,
fill_cache
=
True
,
device
=
device
)
assert
mat
.
device
()
==
device
assert
mat
.
storage
.
sparse_sizes
()
==
(
3
,
4
)
assert
mat
.
storage
.
row
().
tolist
()
==
[
0
,
1
,
2
]
assert
mat
.
storage
.
rowptr
().
tolist
()
==
[
0
,
1
,
2
,
3
]
...
...
@@ -40,8 +40,8 @@ def test_eye(dtype, device):
assert
mat
.
storage
.
csr2csc
().
tolist
()
==
[
0
,
1
,
2
]
assert
mat
.
storage
.
csc2csr
().
tolist
()
==
[
0
,
1
,
2
]
mat
=
SparseTensor
.
eye
(
4
,
3
,
fill_cache
=
True
)
assert
mat
.
storage
.
col
().
device
==
device
mat
=
SparseTensor
.
eye
(
4
,
3
,
fill_cache
=
True
,
device
=
device
)
assert
mat
.
device
()
==
device
assert
mat
.
storage
.
sparse_sizes
()
==
(
4
,
3
)
assert
mat
.
storage
.
row
().
tolist
()
==
[
0
,
1
,
2
]
assert
mat
.
storage
.
rowptr
().
tolist
()
==
[
0
,
1
,
2
,
3
,
3
]
...
...
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