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

[PIR] support matrix_norm and fix backward redundant cast #62958

Merged
merged 10 commits into from
Apr 1, 2024

Conversation

gouzil
Copy link
Member

@gouzil gouzil commented Mar 22, 2024

PR Category

Others

PR Types

Others

Description

  • 拆分TestSundryAPIStatic.test_linalg_norm 单测
  • 适配matrix_normp_matrix_normnuclear_norm 两个方法
  • 删除 backward 中不必要的pd_op.cast fix auto backward bug #63113

原:

{
    (%0) = "pd_op.full" () {dtype:(pd_op.DataType)int64,place:(pd_op.Place)Place(undefined:0),shape:(pd_op.IntArray)[2,2],stop_gradient:[true],value:(Float)0} : () -> builtin.tensor<2x2xi64>
    (%1) = "pd_op.assign_value_" (%0) {dtype:(pd_op.DataType)int64,place:(pd_op.Place)Place(undefined:0),shape:[(Int32)2,(Int32)2],stop_gradient:[true],values:[(Double)3,(Double)3,(Double)3,(Double)3]} : (builtin.tensor<2x2xi64>) -> builtin.tensor<2x2xi64>
    (%2) = "pd_op.cast" (%1) {dtype:(pd_op.DataType)float32,stop_gradient:[false]} : (builtin.tensor<2x2xi64>) -> builtin.tensor<2x2xf32>
    (%3) = "pd_op.full" () {dtype:(pd_op.DataType)float32,place:(pd_op.Place)Place(cpu),shape:(pd_op.IntArray)[1],stop_gradient:[true],value:(Float)1} : () -> builtin.tensor<1xf32>
    (%4) = "pd_op.full_like" (%2, %3) {dtype:(pd_op.DataType)float32,place:(pd_op.Place)Place(undefined:0),stop_gradient:[false]} : (builtin.tensor<2x2xf32>, builtin.tensor<1xf32>) -> builtin.tensor<2x2xf32>
    (%5) = "pd_op.cast" (%4) {dtype:(pd_op.DataType)int64,stop_gradient:[false]} : (builtin.tensor<2x2xf32>) -> <<NULL TYPE>>
}

现:

{
    (%0) = "pd_op.full" () {dtype:(pd_op.DataType)int64,place:(pd_op.Place)Place(undefined:0),shape:(pd_op.IntArray)[2,2],stop_gradient:[true],value:(Float)0} : () -> builtin.tensor<2x2xi64>
    (%1) = "pd_op.assign_value_" (%0) {dtype:(pd_op.DataType)int64,place:(pd_op.Place)Place(undefined:0),shape:[(Int32)2,(Int32)2],stop_gradient:[true],values:[(Double)3,(Double)3,(Double)3,(Double)3]} : (builtin.tensor<2x2xi64>) -> builtin.tensor<2x2xi64>
    (%2) = "pd_op.cast" (%1) {dtype:(pd_op.DataType)float32,stop_gradient:[false]} : (builtin.tensor<2x2xi64>) -> builtin.tensor<2x2xf32>
    (%3) = "pd_op.full" () {dtype:(pd_op.DataType)float32,place:(pd_op.Place)Place(cpu),shape:(pd_op.IntArray)[1],stop_gradient:[true],value:(Float)1} : () -> builtin.tensor<1xf32>
    (%4) = "pd_op.full_like" (%2, %3) {dtype:(pd_op.DataType)float32,place:(pd_op.Place)Place(undefined:0),stop_gradient:[false]} : (builtin.tensor<2x2xf32>, builtin.tensor<1xf32>) -> builtin.tensor<2x2xf32>
}

TODO: 在mac下TestSundryAPIStatic.test_linalg_cond会断错误

相关链接:

@gouzil gouzil requested a review from SigureMo March 22, 2024 09:50
Copy link

paddle-bot bot commented Mar 22, 2024

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot paddle-bot bot added the contributor External developers label Mar 22, 2024
@PaddlePaddle PaddlePaddle locked and limited conversation to collaborators Mar 24, 2024
@PaddlePaddle PaddlePaddle unlocked this conversation Mar 24, 2024
@SigureMo
Copy link
Member

那几个不是随机挂,得看看

@SigureMo
Copy link
Member

另外,breakward 是啥

@gouzil gouzil changed the title [PIR] support matrix_norm and fix breakward redundant cast [PIR] support matrix_norm and fix backward redundant cast Mar 25, 2024
@gouzil
Copy link
Member Author

gouzil commented Mar 25, 2024

另外,breakward 是啥

打错了!!!(超小声)

Copy link
Member

@SigureMo SigureMo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTMeow 🐾

@gouzil gouzil merged commit aed2d92 into PaddlePaddle:develop Apr 1, 2024
29 of 30 checks passed
@gouzil gouzil deleted the fix_test_zero_dim_9 branch April 23, 2024 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants