!48779 [MS][LITE][OPS] fix div no nan op acc bug

Merge pull request !48779 from yefeng/521-fix_div_no_nan_acc_bug
This commit is contained in:
i-robot 2023-02-13 01:13:46 +00:00 committed by Gitee
commit fdf2009595
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 8 additions and 2 deletions

View File

@ -475,9 +475,15 @@ struct DivNoNanFunc<half2> {
__device__ __host__ __forceinline__ half2 operator()(const half2 &lhs, const half2 &rhs) {
float2 l = __half22float2(lhs);
float2 r = __half22float2(rhs);
if ((r.x < kFloatEplison && r.x > -kFloatEplison) || (r.y < kFloatEplison && r.y > -kFloatEplison)) {
if ((r.x < kFloatEplison && r.x > -kFloatEplison) && (r.y < kFloatEplison && r.y > -kFloatEplison)) {
l.x = 0.0;
l.y = 0.0;
} else if ((r.x < kFloatEplison && r.x > -kFloatEplison)) {
l.x = 0.0;
l.y = l.y / r.y;
} else if (r.y < kFloatEplison && r.y > -kFloatEplison) {
l.x = l.x / r.x;
l.y = 0.0;
} else {
l.x = l.x / r.x;
l.y = l.y / r.y;

View File

@ -899,7 +899,7 @@ Status ModelPool::ParseSharedThreadPoolParam(const std::shared_ptr<RunnerConfig>
std::map<std::string, std::map<std::string, std::string>> config_file_info;
if (!runner_config->GetConfigPath().empty()) {
int ret = lite::GetAllSectionInfoFromConfigFile(runner_config->GetConfigPath(), &config_file_info);
if (ret != RET_OK) {
if (ret != lite::RET_OK) {
MS_LOG(ERROR) << "GetAllSectionInfoFromConfigFile failed.";
return kLiteError;
}