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-scatter
Commits
7e82bc0e
"README_DS.md" did not exist on "19acd6cf175e9672c2f2d31ea7becf966674f7aa"
Commit
7e82bc0e
authored
Jan 09, 2020
by
rusty1s
Browse files
update benchmark script
parent
f98ff7e8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
benchmark/scatter_segment.py
benchmark/scatter_segment.py
+12
-12
No files found.
benchmark/scatter_segment.py
View file @
7e82bc0e
...
...
@@ -63,25 +63,25 @@ def correctness(dataset):
assert
torch
.
allclose
(
out1
,
out2
,
atol
=
1e-4
)
assert
torch
.
allclose
(
out1
,
out3
,
atol
=
1e-4
)
out1
,
arg_out1
=
scatter_max
(
x
,
row
,
dim
=
0
,
dim_size
=
dim_size
)
out3
,
arg_out3
=
segment_csr
(
x
,
rowptr
,
reduce
=
'max'
)
#
out1, arg_out1 = scatter_max(x, row, dim=0, dim_size=dim_size)
#
out3, arg_out3 = segment_csr(x, rowptr, reduce='max')
# print(out1[:5])
# print(out3[:5])
nnz
=
(
out1
!=
out3
).
nonzero
().
flatten
()
#
nnz = (out1 != out3).nonzero().flatten()
nnz1
=
nnz
[
0
].
item
()
print
(
rowptr
[
nnz1
],
rowptr
[
nnz1
+
1
])
#
nnz1 = nnz[0].item()
#
print(rowptr[nnz1], rowptr[nnz1 + 1])
print
(
x
[
rowptr
[
nnz1
]:
rowptr
[
nnz1
+
1
]])
print
(
x
[
rowptr
[
nnz1
]:
rowptr
[
nnz1
+
1
]])
#
print(x[rowptr[nnz1]:rowptr[nnz1 + 1]])
#
print(x[rowptr[nnz1]:rowptr[nnz1 + 1]])
print
(
out1
[
nnz1
])
print
(
out3
[
nnz1
])
#
print(out1[nnz1])
#
print(out3[nnz1])
assert
torch
.
allclose
(
out1
,
out3
,
atol
=
1e-4
)
assert
torch
.
all
(
arg_out1
==
arg_out3
)
#
assert torch.allclose(out1, out3, atol=1e-4)
#
assert torch.all(arg_out1 == arg_out3)
except
RuntimeError
:
torch
.
cuda
.
empty_cache
()
...
...
@@ -225,4 +225,4 @@ if __name__ == '__main__':
for
dataset
in
itertools
.
chain
(
short_rows
,
long_rows
):
download
(
dataset
)
correctness
(
dataset
)
#
timing(dataset)
timing
(
dataset
)
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