-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[part 5]change type of function args #38889
[part 5]change type of function args #38889
Conversation
Thanks for your contribution! |
2abd482
to
bf86b84
Compare
return std::llrint( | ||
std::pow(static_cast<double>(args[0]), static_cast<double>(args[1]))); | ||
std::pow(static_cast<double>(a), static_cast<double>(b))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mod和pow也可以用.h里面的functor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
bf86b84
to
7804826
Compare
7804826
to
40ccb07
Compare
T res = fmod(a, b); | ||
if ((res != 0) && ((b < 0) != (res < 0))) res += b; | ||
T res = b % a; | ||
if ((res != 0) && ((res < 0) != (a < 0))) res += a; | ||
return res; | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
下面还有个InverseModFunctorFP
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
InverseModFunctorFP是CPU下,x_dims.size() < y_dims.size()时用到的,暂时没有改动这个接口。只是原来的实现Mod和InverseMode的位置问题,导致diff显示修改了InverseModFunctor
|
||
// Accoding to #PR26732: in dividen % divsor | ||
// remainder shall have the same sign as divsor. | ||
if ((res != 0) && ((b ^ res) < 0)) res += b; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check下判断条件
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里没问题,Mod用的b,InverseMod用的a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. 建议把InverseModFunctorFP
也改了,不然这个代码看着挺迷惑的
PR types
Function optimizationPR changes
OPsDescribe
[part 5]change type of function args因 #38859 支持不同输入类型的elementwise op,需要修改计算函数的参数为值传递