-
Notifications
You must be signed in to change notification settings - Fork 5.9k
[API Compatibility No.354] Implement paddle.addcmul API -part #77333
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
base: develop
Are you sure you want to change the base?
Conversation
…rnels for CPU/GPU (fp16, fp32, fp64, bf16) - Add operator configuration in ops.yaml and backward.yaml - Implement AddcmulInferMeta for shape inference - Add PIR symbolic shape inference support - Add Python API: paddle.addcmul() and Tensor.addcmul() - Add comprehensive test suite (52 tests, all passing) - Add to FP64 gradient threshold whitelist - Formula: output = input + value * tensor1 * tensor2 - Supports broadcasting and multiple dtypes.
… ApiEnhance354
|
你的PR提交成功,感谢你对开源项目的贡献! |
zhwesky2010
left a comment
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.
看下覆盖率,确保都能测到。
同时提前进行下PaConvert测试,确保与torch计算结果一致。截图下PaConvert的case计算结果。
python/paddle/tensor/math.py
Outdated
| return _C_ops.addmm_(input, x, y, beta, alpha) | ||
|
|
||
|
|
||
| def addcmul( |
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.
新增API直接采取C++下沉的方法吧,这个可以不加
1179fb5 to
ca45edd
Compare
|
/re-run all-failed |
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.
这个PR看怎么减小下大小
python/paddle/_paddle_docs.py
Outdated
|
|
||
| add_doc_and_signature( | ||
| "i1", | ||
| "addcmul", |
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下所有改动是否符合预期
a9a8f4b to
a20a003
Compare
python/paddle/tensor/math.py
Outdated
| return _C_ops.addmm_(input, x, y, beta, alpha) | ||
|
|
||
|
|
||
| # def addcmul( |
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.
这个PR压缩下行数,这些删除掉
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #77333 +/- ##
==========================================
Coverage ? 35.27%
==========================================
Files ? 8
Lines ? 258
Branches ? 0
==========================================
Hits ? 91
Misses ? 167
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
/re-run all-failed |
PR Category
User Experience
PR Types
New features
Description
This PR implements the
addcmuloperator for PaddlePaddle, which performs element-wise multiplication of two tensors, multiplies the result by a scalar value, and adds it to an input tensor.Formula:
output = input + value * tensor1 * tensor2This operator provides users with a convenient operation for combined multiply-add computations.
Implementation Details
Core Components
C++ Kernels (
paddle/phi/kernels/)addcmul_kernel.hand implementations for CPU/GPUaddcmul_grad_kernel.hand implementations for CPU/GPUimpl/directory with templated functions for different ranks (0-6D)Operator Configuration (
paddle/phi/ops/yaml/)addcmuloperator definition inops.yamladdcmul_gradbackward operator inbackward.yamlShape Inference (
paddle/phi/infermeta/)AddcmulInferMetainternary.cc/hPIR Support (
paddle/fluid/pir/dialect/operator/interface/infer_symbolic_shape/)AddcmulOpInferSymbolicShapefor new IR systemPython API (
python/paddle/tensor/)paddle.addcmul()function inmath.pyTensor.addcmul()method in__init__.pyTesting (
test/legacy_test/)Configuration (
test/white_list/)addcmulto FP64 gradient threshold whitelistFeatures
torch.addcmulTesting Results
All 52 tests pass successfully:
Test coverage includes:
valueparameters (positive, negative, default)tensor.addcmul())API Examples
Dynamic Graph Mode
Static Graph Mode
Broadcasting
Backward Compatibility
This PR adds new functionality without modifying existing APIs or behaviors. It is fully backward compatible.
Checklist
Related Issues
【启航计划】PaddlePaddle API兼容性增强 No.354
Additional Notes
MPTypeTraitfor numerical stabilityFiles Changed
New Files (9):
Modified Files (9):