Unverified Commit e794a63c authored by Umang Yadav's avatar Umang Yadav Committed by GitHub
Browse files

Remove clamping for converts (#1853)

Fixes #1852  Fixes #1847
parent 01342ae1
......@@ -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;
};
}
......
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment