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
66bcc36e
Commit
66bcc36e
authored
Jul 19, 2021
by
rusty1s
Browse files
fix pytorch 1.8.0 compatibility
parent
1f49a3a5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
6 deletions
+8
-6
csrc/cuda/segment_coo_cuda.cu
csrc/cuda/segment_coo_cuda.cu
+2
-2
csrc/scatter.cpp
csrc/scatter.cpp
+2
-2
torch_scatter/scatter.py
torch_scatter/scatter.py
+4
-2
No files found.
csrc/cuda/segment_coo_cuda.cu
View file @
66bcc36e
...
...
@@ -277,9 +277,9 @@ segment_coo_cuda(torch::Tensor src, torch::Tensor index,
for
(
int
i
=
dim
+
1
;
i
<
out
.
dim
();
i
++
)
count
=
count
.
unsqueeze
(
-
1
);
if
(
out
.
is_floating_point
())
out
.
div
_
(
count
);
out
.
true_divide
_
(
count
);
else
out
.
div_
(
count
,
"floor"
);
out
.
floor_divide_
(
count
);
}
});
});
...
...
csrc/scatter.cpp
View file @
66bcc36e
...
...
@@ -130,9 +130,9 @@ public:
count
.
masked_fill_
(
count
<
1
,
1
);
count
=
broadcast
(
count
,
out
,
dim
);
if
(
out
.
is_floating_point
())
out
.
div
_
(
count
);
out
.
true_divide
_
(
count
);
else
out
.
div_
(
count
,
"floor"
);
out
.
floor_divide_
(
count
);
ctx
->
save_for_backward
({
index
,
count
});
if
(
optional_out
.
has_value
())
...
...
torch_scatter/scatter.py
View file @
66bcc36e
...
...
@@ -52,8 +52,10 @@ def scatter_mean(src: torch.Tensor, index: torch.Tensor, dim: int = -1,
count
=
scatter_sum
(
ones
,
index
,
index_dim
,
None
,
dim_size
)
count
[
count
<
1
]
=
1
count
=
broadcast
(
count
,
out
,
dim
)
rounding_mode
=
None
if
torch
.
is_floating_point
(
out
)
else
'floor'
out
.
div_
(
count
,
rounding_mode
=
rounding_mode
)
if
out
.
is_floating_point
():
out
.
true_divide_
(
count
)
else
:
out
.
floor_divide_
(
count
)
return
out
...
...
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