Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
60557bc6
Commit
60557bc6
authored
Jul 03, 2019
by
Shucai Xiao
Browse files
clang format
parent
795a7083
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
12 deletions
+20
-12
src/include/migraphx/op/reduce_mean.hpp
src/include/migraphx/op/reduce_mean.hpp
+10
-6
src/include/migraphx/op/reduce_sum.hpp
src/include/migraphx/op/reduce_sum.hpp
+10
-6
No files found.
src/include/migraphx/op/reduce_mean.hpp
View file @
60557bc6
...
...
@@ -34,13 +34,16 @@ struct reduce_mean
return
{
s
.
type
(),
lens
};
}
template
<
class
T
>
void
calc_mean
(
tensor_view
<
T
>&
input
,
shape
&
batch_shape
,
std
::
vector
<
std
::
size_t
>&
out_idx
,
tensor_view
<
T
>&
output
)
const
template
<
class
T
>
void
calc_mean
(
tensor_view
<
T
>&
input
,
shape
&
batch_shape
,
std
::
vector
<
std
::
size_t
>&
out_idx
,
tensor_view
<
T
>&
output
)
const
{
auto
data_idx
=
out_idx
;
T
val
=
T
{
0
};
shape_for_each
(
batch_shape
,
[
&
](
auto
b_idx
)
{
for
(
auto
axis
:
axes
)
for
(
auto
axis
:
axes
)
{
data_idx
[
axis
]
=
b_idx
[
axis
];
}
...
...
@@ -55,7 +58,8 @@ struct reduce_mean
argument
result
{
output_shape
};
auto
arg_lens
=
args
.
front
().
get_shape
().
lens
();
std
::
vector
<
std
::
size_t
>
batch_lens
(
output_shape
.
lens
().
size
(),
1
);
for
(
auto
axis
:
axes
)
{
for
(
auto
axis
:
axes
)
{
batch_lens
[
axis
]
=
arg_lens
[
axis
];
}
shape
batch_shape
{
output_shape
.
type
(),
batch_lens
};
...
...
src/include/migraphx/op/reduce_sum.hpp
View file @
60557bc6
...
...
@@ -34,13 +34,16 @@ struct reduce_sum
return
{
s
.
type
(),
lens
};
}
template
<
class
T
>
void
calc_sum
(
tensor_view
<
T
>&
input
,
shape
&
batch_shape
,
std
::
vector
<
std
::
size_t
>&
out_idx
,
tensor_view
<
T
>&
output
)
const
template
<
class
T
>
void
calc_sum
(
tensor_view
<
T
>&
input
,
shape
&
batch_shape
,
std
::
vector
<
std
::
size_t
>&
out_idx
,
tensor_view
<
T
>&
output
)
const
{
auto
data_idx
=
out_idx
;
T
val
=
T
{
0
};
shape_for_each
(
batch_shape
,
[
&
](
auto
b_idx
)
{
for
(
auto
axis
:
axes
)
for
(
auto
axis
:
axes
)
{
data_idx
[
axis
]
=
b_idx
[
axis
];
}
...
...
@@ -55,7 +58,8 @@ struct reduce_sum
argument
result
{
output_shape
};
auto
arg_lens
=
args
.
front
().
get_shape
().
lens
();
std
::
vector
<
std
::
size_t
>
batch_lens
(
output_shape
.
lens
().
size
(),
1
);
for
(
auto
axis
:
axes
)
{
for
(
auto
axis
:
axes
)
{
batch_lens
[
axis
]
=
arg_lens
[
axis
];
}
shape
batch_shape
{
output_shape
.
type
(),
batch_lens
};
...
...
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