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
f056396b
"vscode:/vscode.git/clone" did not exist on "0b6f535f66e092cf96f7b17092c35a3bdf801ed3"
Commit
f056396b
authored
Feb 03, 2020
by
rusty1s
Browse files
fixed negative dims
parent
d3aabdf3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
8 deletions
+3
-8
csrc/cpu/scatter_cpu.cpp
csrc/cpu/scatter_cpu.cpp
+0
-3
csrc/cuda/scatter_cuda.cu
csrc/cuda/scatter_cuda.cu
+0
-3
csrc/scatter.cpp
csrc/scatter.cpp
+3
-2
No files found.
csrc/cpu/scatter_cpu.cpp
View file @
f056396b
...
...
@@ -17,9 +17,6 @@ scatter_cpu(torch::Tensor src, torch::Tensor index, int64_t dim,
for
(
auto
i
=
0
;
i
<
index
.
dim
()
-
1
;
i
++
)
CHECK_INPUT
(
src
.
size
(
i
)
>=
index
.
size
(
i
));
if
(
dim
<
0
)
dim
=
src
.
dim
()
+
dim
;
src
=
src
.
contiguous
();
torch
::
Tensor
out
;
...
...
csrc/cuda/scatter_cuda.cu
View file @
f056396b
...
...
@@ -69,9 +69,6 @@ scatter_cuda(torch::Tensor src, torch::Tensor index, int64_t dim,
for
(
auto
i
=
0
;
i
<
index
.
dim
()
-
1
;
i
++
)
CHECK_INPUT
(
src
.
size
(
i
)
>=
index
.
size
(
i
));
if
(
dim
<
0
)
dim
=
src
.
dim
()
+
dim
;
src
=
src
.
contiguous
();
torch
::
Tensor
out
;
...
...
csrc/scatter.cpp
View file @
f056396b
...
...
@@ -8,8 +8,6 @@
#endif
torch
::
Tensor
broadcast
(
torch
::
Tensor
src
,
torch
::
Tensor
other
,
int64_t
dim
)
{
if
(
dim
<
0
)
dim
=
other
.
dim
()
+
dim
;
if
(
src
.
dim
()
==
1
)
for
(
auto
i
=
0
;
i
<
dim
;
i
++
)
src
=
src
.
unsqueeze
(
0
);
...
...
@@ -43,6 +41,7 @@ public:
Variable
index
,
int64_t
dim
,
torch
::
optional
<
Variable
>
optional_out
,
torch
::
optional
<
int64_t
>
dim_size
)
{
dim
=
dim
<
0
?
src
.
dim
()
+
dim
:
dim
;
ctx
->
saved_data
[
"dim"
]
=
dim
;
ctx
->
saved_data
[
"src_shape"
]
=
src
.
sizes
();
index
=
broadcast
(
index
,
src
,
dim
);
...
...
@@ -116,6 +115,7 @@ public:
Variable
index
,
int64_t
dim
,
torch
::
optional
<
Variable
>
optional_out
,
torch
::
optional
<
int64_t
>
dim_size
)
{
dim
=
dim
<
0
?
src
.
dim
()
+
dim
:
dim
;
ctx
->
saved_data
[
"dim"
]
=
dim
;
ctx
->
saved_data
[
"src_shape"
]
=
src
.
sizes
();
...
...
@@ -151,6 +151,7 @@ public:
Variable
index
,
int64_t
dim
,
torch
::
optional
<
Variable
>
optional_out
,
torch
::
optional
<
int64_t
>
dim_size
)
{
dim
=
dim
<
0
?
src
.
dim
()
+
dim
:
dim
;
ctx
->
saved_data
[
"dim"
]
=
dim
;
ctx
->
saved_data
[
"src_shape"
]
=
src
.
sizes
();
...
...
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