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
335525a7
Commit
335525a7
authored
Jan 13, 2021
by
rusty1s
Browse files
fix nan values
parent
68f4609c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
0 deletions
+1
-0
csrc/scatter.cpp
csrc/scatter.cpp
+1
-0
No files found.
csrc/scatter.cpp
View file @
335525a7
...
@@ -97,6 +97,7 @@ public:
...
@@ -97,6 +97,7 @@ public:
auto
dim
=
ctx
->
saved_data
[
"dim"
].
toInt
();
auto
dim
=
ctx
->
saved_data
[
"dim"
].
toInt
();
auto
src_shape
=
list2vec
(
ctx
->
saved_data
[
"src_shape"
].
toIntList
());
auto
src_shape
=
list2vec
(
ctx
->
saved_data
[
"src_shape"
].
toIntList
());
auto
grad_in
=
torch
::
gather
(
grad_out
*
out
,
dim
,
index
,
false
).
div_
(
src
);
auto
grad_in
=
torch
::
gather
(
grad_out
*
out
,
dim
,
index
,
false
).
div_
(
src
);
grad_in
.
masked_fill_
(
grad_in
.
isnan
(),
0
);
return
{
grad_in
,
Variable
(),
Variable
(),
Variable
(),
Variable
()};
return
{
grad_in
,
Variable
(),
Variable
(),
Variable
(),
Variable
()};
}
}
};
};
...
...
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