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
gaoqiong
MIGraphX
Commits
27c0ae08
Commit
27c0ae08
authored
Jun 25, 2021
by
Shucai Xiao
Browse files
clang format
parent
dd651742
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
src/include/migraphx/op/scatter.hpp
src/include/migraphx/op/scatter.hpp
+3
-3
src/targets/gpu/device/scatter.cpp
src/targets/gpu/device/scatter.cpp
+4
-4
No files found.
src/include/migraphx/op/scatter.hpp
View file @
27c0ae08
...
...
@@ -51,9 +51,9 @@ struct scatter
args
[
1
].
visit
([
&
](
auto
indices
)
{
auto
ind_s
=
indices
.
get_shape
();
shape_for_each
(
ind_s
,
[
&
](
const
auto
&
idx
)
{
auto
out_idx
=
idx
;
auto
index
=
indices
[
ind_s
.
index
(
idx
)];
index
=
(
index
<
0
)
?
index
+
axis_dim_size
:
index
;
auto
out_idx
=
idx
;
auto
index
=
indices
[
ind_s
.
index
(
idx
)];
index
=
(
index
<
0
)
?
index
+
axis_dim_size
:
index
;
out_idx
[
axis
]
=
index
;
output
[
output_shape
.
index
(
out_idx
)]
=
update
[
ind_s
.
index
(
idx
)];
});
...
...
src/targets/gpu/device/scatter.cpp
View file @
27c0ae08
...
...
@@ -13,8 +13,8 @@ namespace device {
argument
scatter
(
hipStream_t
stream
,
argument
result
,
argument
arg0
,
argument
arg1
,
argument
arg2
,
int64_t
axis
)
{
auto
ds
=
arg0
.
get_shape
();
auto
inds
=
arg1
.
get_shape
();
auto
ds
=
arg0
.
get_shape
();
auto
inds
=
arg1
.
get_shape
();
auto
axis_dim_size
=
ds
.
lens
()[
axis
];
hip_visit_all
(
result
,
arg0
,
inds
)([
&
](
auto
output
,
auto
data
,
auto
s1
)
{
auto
*
output_ptr
=
device_cast
(
output
.
data
());
...
...
@@ -26,8 +26,8 @@ argument scatter(
const
auto
*
indices_ptr
=
device_cast
(
indices
.
data
());
gs_launch
(
stream
,
inds
.
elements
(),
256
)([
=
](
auto
i
)
__device__
{
auto
out_idx
=
s1
.
multi
(
i
);
auto
index
=
indices_ptr
[
i
];
index
=
index
<
0
?
index
+
axis_dim_size
:
index
;
auto
index
=
indices_ptr
[
i
];
index
=
index
<
0
?
index
+
axis_dim_size
:
index
;
out_idx
[
axis
]
=
index
;
output
[
out_idx
]
=
upd_ptr
[
i
];
});
...
...
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