[Fix Big Tensor] Fix backward accuracy diff of paddle.linalg.slogdet #74537
Merged
wanghuancoder merged 2 commits intoPaddlePaddle:developfrom Aug 12, 2025
Merged
[Fix Big Tensor] Fix backward accuracy diff of paddle.linalg.slogdet #74537wanghuancoder merged 2 commits intoPaddlePaddle:developfrom
wanghuancoder merged 2 commits intoPaddlePaddle:developfrom
Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
lshpku
approved these changes
Aug 12, 2025
maxiaolong001
pushed a commit
to maxiaolong001/Paddle
that referenced
this pull request
Aug 12, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Category
Operator Mechanism
PR Types
Bug fixes
Description
Paddle文档中的介绍 paddle.linalg.slogdet(x) 计算批量矩阵 的 行列式值的符号值 和 行列式值绝对值的自然对数值
之前的修理PR #73706
主要修改:
分批次处理:
原始的(不分批的)处理,导致报错如下:
根本原因在于如下过程,求逆矩阵时 cublasMatInv 对 batch_size 有限制,故在 batch_size > 65536 时分多个批次串行的方式解决,而 batch_size <= 65536 时不作改变。
phi::funcs::MatrixInverseFunctor<Context, T> mat_inv; mat_inv(dev_ctx, x, &inverse_A);大Tensor时的精度问题:
Torch 支持该 API 在大tensor计算的,在原测试case下数值在90%以上对不齐。经PaddleAPITest测试 输入张量过了一定数量级后就有错,是妥妥的 paddle big tensor 问题

但经由 PaddleAPITest 的近期 PR 和 Paddle 近期相关 MatrixInverseFunctor 和 Transpose 的PR;使得问题得以解决,原测试case全部通过