-
Notifications
You must be signed in to change notification settings - Fork 26.3k
add fill_diagonal function #21892
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
add fill_diagonal function #21892
Conversation
colesbury
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.
Thanks for taking on this issue! This needs a few changes before it can be merged:
- The API should match the NumPy API: https://docs.scipy.org/doc/numpy/reference/generated/numpy.fill_diagonal.html
- The function needs API documentation (in torch/_torch_docs.py)
- The function needs unit tests. (In test/test_torch.py)
Once the PR is ready for review, please click "dismiss review" on this
2. add API doc 3. add unit tests
# Conflicts: # aten/src/ATen/core/Type.h
|
To add to what @colesbury said, the name will also need to be changed to have a trailing underscore, since it modifies the input tensor. |
|
@apaszke Already add trailing underscore to function name. Thank you @colesbury I had add docs&unit tests and match this API to Numpy API |
colesbury
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.
Nice! Looking pretty good
2. add large dim unit test 3. remove function
|
@colesbury I fixed those bug. It's ready for review again. |
colesbury
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.
Some of the continuous builds are failing (test_torch (__main__.TestDocCoverage)) I think because of the function listed in torch.rst but it's not in the torch package.
Otherwise looks good to go
|
@colesbury Thank you. I removed |
|
@pytorchbot rebase this please. |
|
There's nothing to do! This branch is already up to date with master (d2ceab2). (To learn more about this bot, see Bot commands.) |
|
@colesbury I think this's ready for merge |
facebook-github-bot
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.
@colesbury has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
Thanks @shihongzhi! |
|
Can we move the definition to a different file? It seems to me that fill_diagonal is not a factory. Perhaps create Fill.cpp and move both |
|
@xuhdev yes, that seems reasonable. Do you want to make the change after this lands? |
Summary: Fixes pytorch/pytorch#21796 Pull Request resolved: pytorch/pytorch#21892 Differential Revision: D16164678 Pulled By: colesbury fbshipit-source-id: 85df8ae9b7a6a91b6023fe7295b3a8124e4526ea
|
@colesbury merged this pull request in 45cf33a. |
|
@colesbury See #22758 |
Enable Bfloat16 tests in test_torch for cuda fbshipit-source-id: 85df8ae9b7a6a91b6023fe7295b3a8124e4526ea gh-metadata: pytorch pytorch 22772 gh/izdeby/16/head
Enable Bfloat16 tests in test_torch for cuda fbshipit-source-id: 85df8ae9b7a6a91b6023fe7295b3a8124e4526ea gh-metadata: pytorch pytorch 22772 gh/izdeby/16/head
Fixes #21796