Skip to content

Forbid having TensorImpl with zero number of elements and null data. #4909

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

Merged
merged 1 commit into from
Aug 27, 2024
Merged

Forbid having TensorImpl with zero number of elements and null data. #4909

merged 1 commit into from
Aug 27, 2024

Conversation

shoumikhin
Copy link
Contributor

Summary: .

Differential Revision: D61810277

Copy link

pytorch-bot bot commented Aug 26, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/4909

Note: Links to docs will display an error until the docs builds have been completed.

✅ You can merge normally! (1 Unrelated Failure)

As of commit 60a1908 with merge base 7efdfc0 (image):

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 26, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D61810277

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D61810277

1 similar comment
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D61810277

#4909)

Summary:
Pull Request resolved: #4909

`numel_ == 0 && data_ == nullptr`
This represents an empty tensor. Common after initialization or after resizing to zero elements.

`numel_ == 0 && data_ != nullptr`
Unusual, but this can occur if a tensor is resized to zero elements and retains its allocated memory. Useful for quick resizing back to non-zero elements without reallocation.

`numel_ > 0 && data_ == nullptr`
Tensor with shape but no allocated memory. Common after initialization or when memory allocation is deferred.

`numel_ > 0 && data_ != nullptr`
Normal state for a non-empty tensor with allocated memory.

Reviewed By: dbort

Differential Revision: D61810277
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D61810277

@facebook-github-bot facebook-github-bot merged commit 801e1c9 into pytorch:main Aug 27, 2024
35 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants