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
e794a63c
Unverified
Commit
e794a63c
authored
Jun 23, 2023
by
Umang Yadav
Committed by
GitHub
Jun 23, 2023
Browse files
Remove clamping for converts (#1853)
Fixes #1852 Fixes #1847
parent
01342ae1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
13 deletions
+3
-13
src/include/migraphx/op/convert.hpp
src/include/migraphx/op/convert.hpp
+1
-11
test/verify/test_pad_highest.cpp
test/verify/test_pad_highest.cpp
+1
-1
test/verify/test_pad_lowest.cpp
test/verify/test_pad_lowest.cpp
+1
-1
No files found.
src/include/migraphx/op/convert.hpp
View file @
e794a63c
...
...
@@ -66,17 +66,7 @@ struct convert : unary<convert>
auto
type
=
target_type
;
return
[
type
](
auto
x
)
{
auto
y
=
x
;
shape
::
visit
(
type
,
[
&
](
auto
as
)
{
// clamping value between target_type's max and min doesn't work for NaNs,
if
(
std
::
isnan
(
x
))
{
y
=
as
.
nan
();
}
else
{
y
=
std
::
min
(
std
::
max
(
as
(
x
),
as
.
min
()),
as
.
max
());
}
});
shape
::
visit
(
type
,
[
&
](
auto
as
)
{
y
=
as
(
x
);
});
return
y
;
};
}
...
...
test/verify/test_pad_highest.cpp
View file @
e794a63c
...
...
@@ -38,7 +38,7 @@ struct test_pad_highest : verify_program<test_pad_highest>
migraphx
::
shape
s0
{
migraphx
::
shape
::
half_type
,
{
2
,
2
}};
auto
l0
=
mm
->
add_literal
(
migraphx
::
literal
{
s0
,
data0
});
migraphx
::
op
::
pad
op
{};
op
.
value
=
std
::
numeric_limits
<
float
>::
max
();
op
.
value
=
std
::
numeric_limits
<
migraphx
::
half
>::
max
();
op
.
pads
=
{
0
,
0
,
1
,
1
};
mm
->
add_instruction
(
op
,
l0
);
return
p
;
...
...
test/verify/test_pad_lowest.cpp
View file @
e794a63c
...
...
@@ -38,7 +38,7 @@ struct test_pad_lowest : verify_program<test_pad_lowest>
migraphx
::
shape
s0
{
migraphx
::
shape
::
half_type
,
{
2
,
2
}};
auto
l0
=
mm
->
add_literal
(
migraphx
::
literal
{
s0
,
data0
});
migraphx
::
op
::
pad
op
{};
op
.
value
=
std
::
numeric_limits
<
float
>::
lowest
();
op
.
value
=
std
::
numeric_limits
<
migraphx
::
half
>::
lowest
();
op
.
pads
=
{
0
,
0
,
1
,
1
};
mm
->
add_instruction
(
op
,
l0
);
return
p
;
...
...
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