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
a95ac7f5
Commit
a95ac7f5
authored
Dec 16, 2017
by
rusty1s
Browse files
rename
parent
8ef7174b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
13 deletions
+3
-13
build.py
build.py
+1
-1
test/test_add.py
test/test_add.py
+2
-12
No files found.
build.py
View file @
a95ac7f5
...
...
@@ -12,7 +12,7 @@ extra_objects = []
with_cuda
=
False
ffi
=
create_extension
(
name
=
'torch_scatter._ext.
scatter
'
,
name
=
'torch_scatter._ext.
ffi
'
,
package
=
True
,
verbose
=
True
,
headers
=
headers
,
...
...
test/test_add.py
View file @
a95ac7f5
from
nose.tools
import
assert_equal
import
torch
from
torch_scatter._ext
import
scatter
from
torch_scatter._ext
import
ffi
def
test_scatter_add
():
...
...
@@ -12,15 +12,5 @@ def test_scatter_add():
output
=
input
.
new
(
2
,
6
).
fill_
(
0
)
expected_output
=
[[
0
,
0
,
4
,
3
,
3
,
0
],
[
2
,
4
,
4
,
0
,
0
,
0
]]
scatter
.
scatter_add_Float
(
output
,
index
,
input
,
1
)
ffi
.
scatter_add_Float
(
output
,
index
,
input
,
1
)
assert_equal
(
output
.
tolist
(),
expected_output
)
n
=
10000
input
=
torch
.
rand
(
torch
.
Size
([
n
]))
index
=
(
torch
.
rand
(
torch
.
Size
([
n
]))
*
n
).
long
()
output
=
input
.
new
(
n
).
fill_
(
0
)
expected_output
=
input
.
new
(
n
).
fill_
(
0
)
scatter
.
scatter_add_Float
(
output
,
index
,
input
,
0
)
expected_output
.
scatter_add_
(
0
,
index
,
input
)
assert_equal
(
output
.
tolist
(),
expected_output
.
tolist
())
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