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
1697b6bb
Commit
1697b6bb
authored
Dec 27, 2017
by
rusty1s
Browse files
bugfix
parent
0f1dc7bc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletion
+17
-1
test/forward.json
test/forward.json
+16
-0
torch_scatter/functions/sub.py
torch_scatter/functions/sub.py
+1
-1
No files found.
test/forward.json
View file @
1697b6bb
...
@@ -6,5 +6,21 @@
...
@@ -6,5 +6,21 @@
"input"
:
[[
2
,
0
,
1
,
4
,
3
],
[
0
,
2
,
1
,
3
,
4
]],
"input"
:
[[
2
,
0
,
1
,
4
,
3
],
[
0
,
2
,
1
,
3
,
4
]],
"dim"
:
1
,
"dim"
:
1
,
"expected"
:
[[
0
,
0
,
4
,
3
,
3
,
0
],
[
2
,
4
,
4
,
0
,
0
,
0
]]
"expected"
:
[[
0
,
0
,
4
,
3
,
3
,
0
],
[
2
,
4
,
4
,
0
,
0
,
0
]]
},
{
"name"
:
"sub"
,
"output"
:
[[
0
,
0
,
0
,
0
,
0
,
0
],
[
0
,
0
,
0
,
0
,
0
,
0
]],
"index"
:
[[
4
,
5
,
4
,
2
,
3
],
[
0
,
0
,
2
,
2
,
1
]],
"input"
:
[[
2
,
0
,
1
,
4
,
3
],
[
0
,
2
,
1
,
3
,
4
]],
"dim"
:
1
,
"expected"
:
[[
0
,
0
,
-4
,
-3
,
-3
,
0
],
[
-2
,
-4
,
-4
,
0
,
0
,
0
]]
},
{
"name"
:
"mul"
,
"output"
:
[[
1
,
1
,
1
,
1
,
1
,
1
],
[
1
,
1
,
1
,
1
,
1
,
1
]],
"index"
:
[[
4
,
5
,
4
,
2
,
3
],
[
0
,
0
,
2
,
2
,
1
]],
"input"
:
[[
2
,
0
,
1
,
4
,
3
],
[
0
,
2
,
1
,
3
,
4
]],
"dim"
:
1
,
"expected"
:
[[
1
,
1
,
4
,
3
,
2
,
0
],
[
0
,
4
,
3
,
1
,
1
,
1
]]
}
}
]
]
torch_scatter/functions/sub.py
View file @
1697b6bb
...
@@ -51,7 +51,7 @@ def scatter_sub_(output, index, input, dim=0):
...
@@ -51,7 +51,7 @@ def scatter_sub_(output, index, input, dim=0):
-2 -4 -4 0 0 0
-2 -4 -4 0 0 0
[torch.FloatTensor of size 2x6]
[torch.FloatTensor of size 2x6]
"""
"""
return
output
.
scatter_add_
(
dim
,
index
,
-
input
)
return
output
.
scatter_add_
(
dim
,
index
,
-
1
*
input
)
def
scatter_sub
(
index
,
input
,
dim
=
0
,
size
=
None
,
fill_value
=
0
):
def
scatter_sub
(
index
,
input
,
dim
=
0
,
size
=
None
,
fill_value
=
0
):
...
...
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