Skip to content

Conversation

@kurtamohler
Copy link
Collaborator

@kurtamohler kurtamohler commented Jul 23, 2020

BC-Breaking Note:
BC breaking changes in the case where keepdim=True. Before this change, when calling torch.norm with keepdim=True and p='fro' or p=number, leaving all other optional arguments as their default values, the keepdim argument would be ignored. Also, any time torch.norm was called with p='nuc' and keepdim=True, the result would have one fewer dimension than the input, and the dimensions could be out of order depending on which dimensions were being reduced. After the change, for each of these cases, the result has the same number and order of dimensions as the input.

PR Summary:

  • Fix keepdim behavior
  • Throw descriptive errors for unsupported sparse norm args
  • Increase unit test coverage for these cases and for complex inputs

These changes were taken from part of PR #40924. That PR is not going to be merged because it overrides torch.norm's interface, which we want to avoid. But these improvements are still useful.

Issue #24802

@dr-ci
Copy link

dr-ci bot commented Jul 23, 2020

💊 CI failures summary and remediations

As of commit ab7546e (more details on the Dr. CI page):


💚 💚 Looks good so far! There are no failures yet. 💚 💚


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group.

See how this bot performed.

This comment has been revised 30 times.

@kurtamohler kurtamohler force-pushed the norm-functionality-fixes-24802 branch 2 times, most recently from ba0fcdc to 50b7cca Compare July 24, 2020 17:54
@kurtamohler kurtamohler changed the title Fix incorrect torch.norm behavior Improve torch.norm functionality, errors, and tests Jul 24, 2020
@kurtamohler kurtamohler marked this pull request as ready for review July 24, 2020 18:05
@kurtamohler kurtamohler requested a review from mruberry July 24, 2020 18:05
@kurtamohler kurtamohler force-pushed the norm-functionality-fixes-24802 branch from 50b7cca to 933fcc9 Compare July 24, 2020 21:02
@ngimel ngimel added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Jul 26, 2020
@kurtamohler
Copy link
Collaborator Author

I'm pretty sure the pr/pytorch-linux-xenial-rocm3.5.1-py3.6 failure isn't my fault. Looks like it timed out before even starting the tests.

@mruberry
Copy link
Collaborator

I'm pretty sure the pr/pytorch-linux-xenial-rocm3.5.1-py3.6 failure isn't my fault. Looks like it timed out before even starting the tests.

It's not. Unfortunately that build's very flaky, sorry. Also, I hope to get a chance to look at this later today. Sorry to keep you waiting, @kurtamohler.

@kurtamohler
Copy link
Collaborator Author

No worries @mruberry !

Copy link
Collaborator

@mruberry mruberry left a comment

Choose a reason for hiding this comment

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

Hey @kurtamohler! This looks pretty good to me. I added a couple requests for comments and suggested some changes to the test for coverage and maintainability.

This will be BC-breaking for users who were using keepdims previously, right? Would you write a "BC-Breaking Note" section at the top of the PR summary describing the before/after? We use these notes to write the release docs.

@mruberry mruberry added the module: bc-breaking Related to a BC-breaking change label Jul 29, 2020
* Fix keepdim behavior in nuclear_norm and norm
* Throw descriptive errors for unsupported sparse norm args
* Increase unit test coverage for these cases and for complex inputs
@kurtamohler kurtamohler force-pushed the norm-functionality-fixes-24802 branch from bc37b5f to ab7546e Compare July 30, 2020 05:25
@kurtamohler
Copy link
Collaborator Author

Thanks for the review @mruberry! I believe I've addressed all your suggestions now. Also added the BC breaking note in the description.

@mruberry mruberry added the module: linear algebra Issues related to specialized linear algebra operations in PyTorch; includes matrix multiply matmul label Jul 30, 2020
@mruberry mruberry self-requested a review July 30, 2020 05:43
Copy link
Collaborator

@mruberry mruberry left a comment

Choose a reason for hiding this comment

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

Thanks @kurtamohler! Looks great.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@mruberry has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@mruberry merged this pull request in 206db5c.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Merged module: bc-breaking Related to a BC-breaking change module: linear algebra Issues related to specialized linear algebra operations in PyTorch; includes matrix multiply matmul open source triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants