Skip to content

Conversation

@Chillee
Copy link
Collaborator

@Chillee Chillee commented May 5, 2022

Also fixes xlogy (turns out the only thing it was missing was a type cast annotation! nice!)

I also renamed canonicalize_idx => canonicalize_dim (to align with canonicalize_dims) and fixed a bug in it (cc: @mruberry)

@facebook-github-bot
Copy link
Contributor

facebook-github-bot commented May 5, 2022

🔗 Helpful links

💊 CI failures summary and remediations

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

Expand to see more

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


This comment was automatically generated by Dr. CI (expand for details).

Please report bugs/suggestions to the (internal) Dr. CI Users group.

Click here to manually regenerate this comment.

@Chillee Chillee changed the title Add some shape decomps (t, transpose, rot90) Add some shape decomps (t, transpose, rot90, stack) May 5, 2022
@Chillee Chillee requested review from ezyang, mruberry and ngimel May 5, 2022 04:02
assert dims[0] != dims[1] and abs(dims[0] - dims[1]) != total_dims, f"expected rotation dims to be different, but got dim0 = {dims[0]} and dim1 = {dims[1]}"
assert dims[0] < total_dims and dims[0] >= -total_dims, f"Rotation dim0 out of range, dim0 = {dims[0]}"
assert dims[1] < total_dims and dims[1] >= -total_dims, f"Rotation dim1 out of range, dim1 = {dims[1]}"
k = (4 + (k % 4)) % 4
Copy link
Collaborator

Choose a reason for hiding this comment

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

what's this? Modulo of a negative number is what you'd expect (so k=-1 will translate to 3)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

uh... too literal translation of C++ code to Python :P


if idx < 0:
_idx = idx + _rank
else:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice

@Chillee
Copy link
Collaborator Author

Chillee commented May 5, 2022

Could I get an approval on this? (@mruberry, @ngimel)

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.

Stamp

@Chillee
Copy link
Collaborator Author

Chillee commented May 6, 2022

@pytorchbot merge this please

@Chillee
Copy link
Collaborator Author

Chillee commented May 6, 2022

(passed all tests on a previous commit and I just fixed a merge issue, so hopefully good) :)

@github-actions
Copy link
Contributor

github-actions bot commented May 6, 2022

Hey @Chillee.
You've committed this PR, but it does not have both a 'release notes: ...' and 'topics: ...' label. Please add one of each to the PR. The 'release notes: ...' label should represent the part of PyTorch that this PR changes (fx, autograd, distributed, etc) and the 'topics: ...' label should represent the kind of PR it is (not user facing, new feature, bug fix, perf improvement, etc). The list of valid labels can be found here for the 'release notes: ...' and here for the 'topics: ...'.
For changes that are 'topic: not user facing' there is no need for a release notes label.

@Chillee Chillee added module: internals Related to internal abstractions in c10 and ATen topic: not user facing topic category labels May 6, 2022
@Chillee Chillee deleted the shape_decomps branch May 13, 2022 06:33
facebook-github-bot pushed a commit that referenced this pull request May 13, 2022
Summary:
Also fixes xlogy (turns out the only thing it was missing was a type cast annotation! nice!)

I also renamed `canonicalize_idx` => `canonicalize_dim` (to align with `canonicalize_dims`) and fixed a bug in it (cc: mruberry)

Pull Request resolved: #76873
Approved by: https://github.com/mruberry

Test Plan: contbuild & OSS CI, see https://hud.pytorch.org/commit/pytorch/pytorch/e9f34931ef5a4172eac1cc2238218b94beb59b28

Reviewed By: malfet

Differential Revision: D36201593

fbshipit-source-id: 6defbeb0b95ecf205211ed1e2817171905d4c84c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla signed module: internals Related to internal abstractions in c10 and ATen module: primTorch topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants