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
3003844f
"test/vscode:/vscode.git/clone" did not exist on "de167cf5faff8977e9decf573c1a313b146cc48a"
Commit
3003844f
authored
Jul 08, 2019
by
Shucai Xiao
Browse files
clang format
parent
0905762b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
20 deletions
+21
-20
src/include/migraphx/op/reduce_mean.hpp
src/include/migraphx/op/reduce_mean.hpp
+9
-9
src/include/migraphx/op/reduce_sum.hpp
src/include/migraphx/op/reduce_sum.hpp
+9
-9
test/op_shape_test.cpp
test/op_shape_test.cpp
+3
-2
No files found.
src/include/migraphx/op/reduce_mean.hpp
View file @
3003844f
...
@@ -27,21 +27,21 @@ struct reduce_mean
...
@@ -27,21 +27,21 @@ struct reduce_mean
std
::
vector
<
int64_t
>
tune_axes
(
std
::
size_t
n_dim
)
const
std
::
vector
<
int64_t
>
tune_axes
(
std
::
size_t
n_dim
)
const
{
{
auto
tuned_axes
=
axes
;
auto
tuned_axes
=
axes
;
if
(
tuned_axes
.
empty
())
if
(
tuned_axes
.
empty
())
{
{
tuned_axes
.
resize
(
n_dim
);
tuned_axes
.
resize
(
n_dim
);
std
::
iota
(
tuned_axes
.
begin
(),
tuned_axes
.
end
(),
0
);
std
::
iota
(
tuned_axes
.
begin
(),
tuned_axes
.
end
(),
0
);
}
}
else
else
{
{
for
(
std
::
size_t
i
=
0
;
i
<
tuned_axes
.
size
();
++
i
)
for
(
std
::
size_t
i
=
0
;
i
<
tuned_axes
.
size
();
++
i
)
{
{
int64_t
s_dim
=
static_cast
<
int64_t
>
(
n_dim
);
int64_t
s_dim
=
static_cast
<
int64_t
>
(
n_dim
);
if
(
tuned_axes
[
i
]
>=
s_dim
or
tuned_axes
[
i
]
<
-
s_dim
)
if
(
tuned_axes
[
i
]
>=
s_dim
or
tuned_axes
[
i
]
<
-
s_dim
)
{
{
MIGRAPHX_THROW
(
"REDUCE_MEAN: axis out of range"
);
MIGRAPHX_THROW
(
"REDUCE_MEAN: axis out of range"
);
}
}
if
(
tuned_axes
[
i
]
<
0
)
if
(
tuned_axes
[
i
]
<
0
)
{
{
tuned_axes
[
i
]
+=
n_dim
;
tuned_axes
[
i
]
+=
n_dim
;
}
}
...
...
src/include/migraphx/op/reduce_sum.hpp
View file @
3003844f
...
@@ -27,21 +27,21 @@ struct reduce_sum
...
@@ -27,21 +27,21 @@ struct reduce_sum
std
::
vector
<
int64_t
>
tune_axes
(
std
::
size_t
n_dim
)
const
std
::
vector
<
int64_t
>
tune_axes
(
std
::
size_t
n_dim
)
const
{
{
auto
tuned_axes
=
axes
;
auto
tuned_axes
=
axes
;
if
(
tuned_axes
.
empty
())
if
(
tuned_axes
.
empty
())
{
{
tuned_axes
.
resize
(
n_dim
);
tuned_axes
.
resize
(
n_dim
);
std
::
iota
(
tuned_axes
.
begin
(),
tuned_axes
.
end
(),
0
);
std
::
iota
(
tuned_axes
.
begin
(),
tuned_axes
.
end
(),
0
);
}
}
else
else
{
{
for
(
std
::
size_t
i
=
0
;
i
<
tuned_axes
.
size
();
++
i
)
for
(
std
::
size_t
i
=
0
;
i
<
tuned_axes
.
size
();
++
i
)
{
{
int64_t
s_dim
=
static_cast
<
int64_t
>
(
n_dim
);
int64_t
s_dim
=
static_cast
<
int64_t
>
(
n_dim
);
if
(
tuned_axes
[
i
]
>=
s_dim
or
tuned_axes
[
i
]
<
-
s_dim
)
if
(
tuned_axes
[
i
]
>=
s_dim
or
tuned_axes
[
i
]
<
-
s_dim
)
{
{
MIGRAPHX_THROW
(
"REDUCE_SUM: axis out of range"
);
MIGRAPHX_THROW
(
"REDUCE_SUM: axis out of range"
);
}
}
if
(
tuned_axes
[
i
]
<
0
)
if
(
tuned_axes
[
i
]
<
0
)
{
{
tuned_axes
[
i
]
+=
n_dim
;
tuned_axes
[
i
]
+=
n_dim
;
}
}
...
...
test/op_shape_test.cpp
View file @
3003844f
...
@@ -472,7 +472,8 @@ void test_reduce_ops()
...
@@ -472,7 +472,8 @@ void test_reduce_ops()
{
{
migraphx
::
shape
input
{
migraphx
::
shape
::
float_type
,
{
2
,
3
,
4
,
5
}};
migraphx
::
shape
input
{
migraphx
::
shape
::
float_type
,
{
2
,
3
,
4
,
5
}};
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
1
,
1
}},
T
{{
0
,
1
,
2
,
3
}},
input
);
expect_shape
(
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
1
,
1
,
1
,
1
}},
T
{{
0
,
1
,
2
,
3
}},
input
);
}
}
{
{
migraphx
::
shape
input
{
migraphx
::
shape
::
float_type
,
{
2
,
3
,
4
,
5
}};
migraphx
::
shape
input
{
migraphx
::
shape
::
float_type
,
{
2
,
3
,
4
,
5
}};
...
...
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