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
318dbc15
Commit
318dbc15
authored
Aug 27, 2019
by
Shucai Xiao
Browse files
clang format
parent
5e951d3b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
14 deletions
+7
-14
src/quantization.cpp
src/quantization.cpp
+1
-3
tools/include/target.hpp
tools/include/target.hpp
+6
-11
No files found.
src/quantization.cpp
View file @
318dbc15
...
...
@@ -516,9 +516,7 @@ capture_arguments(program& prog, const target& t, const std::vector<std::string>
// consider shift, so set shift to 0
std
::
vector
<
float
>
vec_val
;
auto
&&
arg
=
t
.
copy_from
(
args
.
front
());
arg
.
visit
([
&
](
auto
output
)
{
vec_val
.
assign
(
output
.
begin
(),
output
.
end
());
});
arg
.
visit
([
&
](
auto
output
)
{
vec_val
.
assign
(
output
.
begin
(),
output
.
end
());
});
auto
max_val
=
*
std
::
max_element
(
vec_val
.
begin
(),
vec_val
.
end
());
auto
min_val
=
*
std
::
min_element
(
vec_val
.
begin
(),
vec_val
.
end
());
auto
max_abs
=
std
::
max
(
std
::
fabs
(
max_val
),
std
::
fabs
(
min_val
));
...
...
tools/include/target.hpp
View file @
318dbc15
...
...
@@ -38,33 +38,31 @@ struct target
context
get_context
()
const
;
/**
* @brief copy an argument to the current target.
*
*
* @param arg Input argument to be copied to the target
* @return Argument in the target.
*/
argument
copy_to
(
const
argument
&
arg
)
const
;
/**
* @brief copy an argument from the current target.
*
*
* @param arg Input argument to be copied from the target
* @return Argument in the host.
*/
argument
copy_from
(
const
argument
&
arg
)
const
;
/**
* @brief Allocate an argument based on the input shape
*
*
* @param s Shape of the argument to be allocated in the target
* @return Allocated argument in the target.
*/
argument
allocate
(
const
shape
&
s
)
const
;
};
#else
template
<
class
T
>
auto
target_allocate
(
rank
<
1
>
,
T
&
x
,
const
shape
&
s
)
->
decltype
(
x
.
allocate
(
s
))
auto
target_allocate
(
rank
<
1
>
,
T
&
x
,
const
shape
&
s
)
->
decltype
(
x
.
allocate
(
s
))
{
return
x
.
allocate
(
s
);
}
...
...
@@ -84,8 +82,7 @@ argument target_allocate(T& x, const shape& s)
}
template
<
class
T
>
auto
copy_to_target
(
rank
<
1
>
,
T
&
x
,
const
argument
&
arg
)
->
decltype
(
x
.
copy_to
(
arg
))
auto
copy_to_target
(
rank
<
1
>
,
T
&
x
,
const
argument
&
arg
)
->
decltype
(
x
.
copy_to
(
arg
))
{
return
x
.
copy_to
(
arg
);
}
...
...
@@ -106,9 +103,7 @@ argument copy_to_target(T& x, const argument& arg)
}
template
<
class
T
>
auto
copy_from_target
(
rank
<
1
>
,
T
&
x
,
const
argument
&
arg
)
->
decltype
(
x
.
copy_from
(
arg
))
auto
copy_from_target
(
rank
<
1
>
,
T
&
x
,
const
argument
&
arg
)
->
decltype
(
x
.
copy_from
(
arg
))
{
return
x
.
copy_from
(
arg
);
}
...
...
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