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

fix-abs #5398

Merged
merged 5 commits into from
Jul 6, 2021
Merged

fix-abs #5398

merged 5 commits into from
Jul 6, 2021

Conversation

puchapu
Copy link
Contributor

@puchapu puchapu commented Jul 6, 2021

背景

对齐 torch.fmod 算子时,余数的正负号需与被除数一致。原来的 flow.math.mod 算子符号并未完全对齐。通过 abs(mod(x,y))*sign(x) 对齐遇到了这个问题

  • torch.abs()
    torch.tensor([-0.]).abs() 结果如图
    abs_torch

  • flow.abs()
    flow.tensor([-0.]).abs() 结果如图。可能会造成一些符号无法对齐。
    abs_bug

  • 修改后
    abs

@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot July 6, 2021 04:02
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot July 6, 2021 05:02
@oneflow-ci-bot oneflow-ci-bot merged commit d918dfe into master Jul 6, 2021
@oneflow-ci-bot oneflow-ci-bot deleted the fix_abs branch July 6, 2021 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants