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
32a60c2d
Commit
32a60c2d
authored
Dec 18, 2017
by
rusty1s
Browse files
doc
parent
a4214f3f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
torch_scatter/functions/__init__.py
torch_scatter/functions/__init__.py
+6
-0
No files found.
torch_scatter/functions/__init__.py
View file @
32a60c2d
...
...
@@ -47,6 +47,8 @@ def scatter_div(index, input, dim=0, max_index=None, fill_value=1):
def
scatter_mean_
(
output
,
index
,
input
,
dim
=
0
):
"""If multiple indices reference the same location, their
contributions average."""
output_count
=
gen_filled_tensor
(
output
,
output
.
size
(),
fill_value
=
0
)
scatter
(
'mean'
,
dim
,
output
,
index
,
input
,
output_count
)
output_count
[
output_count
==
0
]
=
1
...
...
@@ -60,6 +62,8 @@ def scatter_mean(index, input, dim=0, max_index=None, fill_value=0):
def
scatter_max_
(
output
,
index
,
input
,
dim
=
0
):
"""If multiple indices reference the same location, the maximal
contribution gets taken."""
output_arg
=
gen_filled_tensor
(
index
,
output
.
size
(),
fill_value
=-
1
)
return
scatter
(
'max'
,
dim
,
output
,
index
,
input
,
output_arg
)
...
...
@@ -70,6 +74,8 @@ def scatter_max(index, input, dim=0, max_index=None, fill_value=0):
def
scatter_min_
(
output
,
index
,
input
,
dim
=
0
):
"""If multiple indices reference the same location, the minimal
contribution gets taken."""
output_arg
=
gen_filled_tensor
(
index
,
output
.
size
(),
fill_value
=-
1
)
return
scatter
(
'min'
,
dim
,
output
,
index
,
input
,
output_arg
)
...
...
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