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
f16e422a
Commit
f16e422a
authored
Apr 28, 2018
by
rusty1s
Browse files
py 2.7 fix
parent
96971292
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
torch_scatter/utils/gen.py
torch_scatter/utils/gen.py
+2
-2
No files found.
torch_scatter/utils/gen.py
View file @
f16e422a
...
@@ -6,14 +6,14 @@ def gen(src, index, dim=-1, out=None, dim_size=None, fill_value=0):
...
@@ -6,14 +6,14 @@ def gen(src, index, dim=-1, out=None, dim_size=None, fill_value=0):
# Automatically expand index tensor to the right dimensions.
# Automatically expand index tensor to the right dimensions.
if
index
.
dim
()
==
1
:
if
index
.
dim
()
==
1
:
index_size
=
[
*
repeat
(
1
,
src
.
dim
())
]
index_size
=
list
(
repeat
(
1
,
src
.
dim
())
)
index_size
[
dim
]
=
src
.
size
(
dim
)
index_size
[
dim
]
=
src
.
size
(
dim
)
index
=
index
.
view
(
index_size
).
expand_as
(
src
)
index
=
index
.
view
(
index_size
).
expand_as
(
src
)
# Generate output tensor if not given.
# Generate output tensor if not given.
if
out
is
None
:
if
out
is
None
:
dim_size
=
index
.
max
()
+
1
if
dim_size
is
None
else
dim_size
dim_size
=
index
.
max
()
+
1
if
dim_size
is
None
else
dim_size
out_size
=
[
*
src
.
size
()
]
out_size
=
list
(
src
.
size
()
)
out_size
[
dim
]
=
dim_size
out_size
[
dim
]
=
dim_size
out
=
src
.
new_full
(
out_size
,
fill_value
)
out
=
src
.
new_full
(
out_size
,
fill_value
)
...
...
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