Skip to content

fill_diagonal op fix border cross caused by offset#36212

Merged
jeff41404 merged 1 commit intoPaddlePaddle:developfrom
zhiboniu:develop_fill_diagonal_fix
Oct 9, 2021
Merged

fill_diagonal op fix border cross caused by offset#36212
jeff41404 merged 1 commit intoPaddlePaddle:developfrom
zhiboniu:develop_fill_diagonal_fix

Conversation

@zhiboniu
Copy link
Copy Markdown
Contributor

@zhiboniu zhiboniu commented Sep 29, 2021

PR types

Bug fixes

PR changes

OPs

Describe

fill_diagonal op fix border cross caused by offset

原来的方式offset非0时修改值会出现跨行的问题,
本次修复添加行位置越界判断,避免了这类问题。

修复前:
x.fill_diagonal_(1,offset=2)
image
修改了(0,2)、(2,0)两个位置,其中(2,0)由(1,1)右移2(offset值)导致。

修复后:
x.fill_diagonal_(4,offset=2)
image
只修改了(0,2)位置

@paddle-bot-old
Copy link
Copy Markdown

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

Comment on lines 112 to 117
Copy link
Copy Markdown
Contributor

@jeff41404 jeff41404 Oct 8, 2021

Choose a reason for hiding this comment

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

suggest adding a annotation to explain this if statement

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Comment on lines 30 to 35
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggest adding a annotation to explain this if statement

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

@jeff41404
Copy link
Copy Markdown
Contributor

and it would be better to add a unittest to cover this case

Copy link
Copy Markdown
Contributor

@jeff41404 jeff41404 left a comment

Choose a reason for hiding this comment

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

lgtm

@jeff41404 jeff41404 merged commit 62e4115 into PaddlePaddle:develop Oct 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants