Skip to content
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

Check support_as_strided before using empty_strided. #46746

Closed
wants to merge 2 commits into from

Conversation

ailzhang
Copy link
Contributor

@ailzhang ailzhang commented Oct 22, 2020

Stack from ghstack:

Differential Revision: D24492468

@dr-ci
Copy link

dr-ci bot commented Oct 22, 2020

💊 CI failures summary and remediations

As of commit d25723e (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 2 times.

ailzhang pushed a commit that referenced this pull request Oct 22, 2020
ghstack-source-id: 5fbdb907428e852ddec8fda8ef16dc643479d7cf
Pull Request resolved: #46746
@facebook-github-bot
Copy link
Contributor

@ailzhang merged this pull request in 4fd2cce.

@facebook-github-bot facebook-github-bot deleted the gh/ailzhang/32/head branch October 26, 2020 14:17
facebook-github-bot pushed a commit that referenced this pull request Oct 29, 2020
Summary:
Possibly fixes #46764.
Computing number of tensor elements in many cases is written as
```
int64_t numel = std::accumulate(oldshape.begin(), oldshape.end(), 1,
                                  std::multiplies<int64_t>());
```
This computes the product with the type of `1` literal, which is `int`. When there's more than INT_MAX elements, result overflows. In #46746, the tensor that was sent to reshape had 256^4 elements, and that was computed as `0`, so reshape was not done correctly.
I've audited usages of std::accumulate and changed them to use int64_t as `init` type.

Pull Request resolved: #46997

Reviewed By: albanD

Differential Revision: D24624654

Pulled By: ngimel

fbshipit-source-id: 3d9c5e6355531a9df6b10500eec140e020aac77e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants