Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skip unaryop round halfway cases for powerpc #5814

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions tests/test_unaryop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,26 @@ static int test_unaryop(const ncnn::Mat& _a)
// smaller range for tan asin acos
Randomize(a, -1.f, 1.f);
}
#if __powerpc__
// nearbyintf produces wrong result in halfway cases, why ?
// too troublesome to resolve the compiler or qemu problem
// so just skip them --- nihui
if (op_type == 18)
{
// drop 0.4 ~ 0.6
for (int i = 0; i < a.total(); i++)
{
float v = a[i];
float vv = fabs(v - (int)v);
while (vv > 0.4f && vv < 0.6f)
{
v = RandomFloat(-15, 15);
vv = fabs(v - (int)v);
}
a[i] = v;
}
}
#endif // __powerpc__

ncnn::ParamDict pd;
pd.set(0, op_type);
Expand Down
Loading