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
5acf2355
Commit
5acf2355
authored
Dec 21, 2017
by
rusty1s
Browse files
more doctests
parent
bc139663
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
1 deletion
+18
-1
torch_scatter/functions/add.py
torch_scatter/functions/add.py
+18
-1
No files found.
torch_scatter/functions/add.py
View file @
5acf2355
...
...
@@ -48,7 +48,6 @@ def scatter_add_(output, index, input, dim=0):
0 0 4 3 3 0
2 4 4 0 0 0
[torch.FloatTensor of size 2x6]
"""
return
output
.
scatter_add_
(
dim
,
index
,
input
)
...
...
@@ -79,6 +78,24 @@ def scatter_add(index, input, dim=0, size=None, fill_value=0):
dim (int, optional): The axis along which to index
size (int, optional): Output size at dimension :attr:`dim`
fill_value (int, optional): Initial filling of output tensor
.. testsetup::
import torch
from torch_scatter import scatter_add
.. testcode::
input = torch.Tensor([[2, 0, 1, 4, 3], [0, 2, 1, 3, 4]])
index = torch.LongTensor([[4, 5, 4, 2, 3], [0, 0, 2, 2, 1]])
output = scatter_add(index, input, dim=1)
print(output)
.. testoutput::
0 0 4 3 3 0
2 4 4 0 0 0
[torch.FloatTensor of size 2x6]
"""
output
=
gen_output
(
index
,
input
,
dim
,
size
,
fill_value
)
return
scatter_add_
(
output
,
index
,
input
,
dim
)
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