-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
use cumprod fix bug of prod_grad #64127
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
…prod_fix pull cumprod
self.check_grad( | ||
['X'], | ||
'Out', | ||
check_pir=True, |
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_pir=True, | |
check_pir=True, | |
check_prim_pir=True, |
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
self.check_grad( | ||
['X'], | ||
'Out', | ||
check_pir=True, |
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_pir=True, | |
check_pir=True, | |
check_prim_pir=True, |
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
) | ||
return x_cotangent[0] | ||
|
||
x = np.random.random((5, 6, 10)).astype(self.data_type) |
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.
建议增大shape
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
@@ -88,6 +96,7 @@ void CumprodKernel(const Context& dev_ctx, | |||
} | |||
} | |||
} | |||
memcpy(out_ptr, out_data, out->numel() * sizeof(T)); |
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.
建议加上判断:if (x_data == out_ptr)
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
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
* add reverse and exclusive * support reverse and exclusive * fix inplace test * fix make on xpu * remove print * update test time * fix prod_grad use cumprod * add 1-5D test * speed up test * mul out_grad * update test * Update CMakeLists.txt * update op_version * update detail.h * update composite * update detail.h * stage * update test * only test on gpu * update details.h * CI * Update composite_backward_api.h * Update details.h * update test * update * Update test_reduce_op.py * fix cumprod cpu bug * update test * update test * update * update * ci * ci * remove comment * CI * Your commit message * CI * update
PR Category
Others
PR Types
Bug fixes
Description
使用双向cumprod修复prod_grad在x有0的时候出现nan的bug
测试代码:
修复前:


修复后:
Important
单测会挂在老动态图+CPU配置上,所以禁用了单测的CPU测试