Skip to content

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

Merged
gouzil merged 10 commits into
PaddlePaddle:developfrom
gouzil:fix_test_zero_dim_9
Apr 1, 2024
Merged

gouzil merged 10 commits into
PaddlePaddle:developfrom
gouzil:fix_test_zero_dim_9

Conversation

@gouzil

@gouzil gouzil commented Mar 22, 2024 •

Copy link
Copy Markdown
Collaborator

PR Category

Others

PR Types

Others

Description

  • 拆分TestSundryAPIStatic.test_linalg_norm 单测
  • 适配matrix_norm 的 p_matrix_norm 和 nuclear_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
@paddle-bot

paddle-bot Bot commented Mar 22, 2024

Copy link
Copy Markdown

你的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
Copy Markdown
Collaborator

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

@SigureMo

Copy link
Copy Markdown
Collaborator

另外,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

gouzil commented Mar 25, 2024

Copy link
Copy Markdown
Collaborator Author

另外,breakward 是啥

打错了!!!(超小声)

@SigureMo SigureMo left a comment

Copy link
Copy Markdown
Collaborator

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
@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