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
752d3ac5
Commit
752d3ac5
authored
May 21, 2019
by
Shucai Xiao
Browse files
clang format
parent
cbfbd04c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
8 deletions
+11
-8
src/include/migraphx/op/convert.hpp
src/include/migraphx/op/convert.hpp
+1
-1
src/targets/gpu/device/convert.cpp
src/targets/gpu/device/convert.cpp
+4
-5
src/targets/gpu/include/migraphx/gpu/device/convert.hpp
src/targets/gpu/include/migraphx/gpu/device/convert.hpp
+6
-2
No files found.
src/include/migraphx/op/convert.hpp
View file @
752d3ac5
...
@@ -40,7 +40,7 @@ struct convert : unary<convert>
...
@@ -40,7 +40,7 @@ struct convert : unary<convert>
{
{
return
[
&
](
auto
x
)
{
return
[
&
](
auto
x
)
{
float
res
=
scale
*
x
+
shift
;
float
res
=
scale
*
x
+
shift
;
if
(
target_type
==
shape
::
int8_type
)
if
(
target_type
==
shape
::
int8_type
)
{
{
res
=
res
>
127.0
?
127.0
:
res
;
res
=
res
>
127.0
?
127.0
:
res
;
res
=
res
<
-
128.0
?
-
128.0
:
res
;
res
=
res
<
-
128.0
?
-
128.0
:
res
;
...
...
src/targets/gpu/device/convert.cpp
View file @
752d3ac5
...
@@ -19,11 +19,10 @@ void convert(hipStream_t stream,
...
@@ -19,11 +19,10 @@ void convert(hipStream_t stream,
auto
*
output_ptr
=
device_cast
(
output
.
data
());
auto
*
output_ptr
=
device_cast
(
output
.
data
());
if
(
target_type
==
shape
::
int8_type
)
if
(
target_type
==
shape
::
int8_type
)
{
{
gs_launch
(
stream
,
result
.
get_shape
().
elements
())(
gs_launch
(
stream
,
result
.
get_shape
().
elements
())([
=
](
auto
i
)
{
[
=
](
auto
i
)
{
output_ptr
[
i
]
=
output_ptr
[
i
]
=
std
::
min
<
int8_t
>
(
std
::
max
<
float
>
(
-
128
,
input_ptr
[
i
]
std
::
min
<
int8_t
>
(
std
::
max
<
float
>
(
-
128
,
input_ptr
[
i
]
*
scale
+
shift
),
127
);
*
scale
+
shift
),
127
);
});
});
}
}
else
else
{
{
...
...
src/targets/gpu/include/migraphx/gpu/device/convert.hpp
View file @
752d3ac5
...
@@ -11,8 +11,12 @@ inline namespace MIGRAPHX_INLINE_NS {
...
@@ -11,8 +11,12 @@ inline namespace MIGRAPHX_INLINE_NS {
namespace
gpu
{
namespace
gpu
{
namespace
device
{
namespace
device
{
void
convert
(
void
convert
(
hipStream_t
stream
,
hipStream_t
stream
,
const
argument
&
result
,
const
argument
&
arg
,
float
scale
,
float
shift
,
shape
::
type_t
target_type
);
const
argument
&
result
,
const
argument
&
arg
,
float
scale
,
float
shift
,
shape
::
type_t
target_type
);
}
// namespace device
}
// namespace device
}
// namespace gpu
}
// namespace gpu
...
...
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