Skip to content

Conversation

@ani300
Copy link
Collaborator

@ani300 ani300 commented Nov 1, 2022

Summary: This diff merges both previous implementations of constructors for nested tensors, the one from lists of tensors and the one with arbitrary python lists, adn implements it in pytorch core so no extensions are needed to construct NT.

@pytorch-bot
Copy link

pytorch-bot bot commented Nov 1, 2022

🔗 Helpful Links

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

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

✅ No Failures

As of commit 76704c9:
💚 Looks good so far! There are no failures yet. 💚

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

@pytorch-bot pytorch-bot bot added the release notes: cpp release notes category label Nov 1, 2022
@facebook-github-bot
Copy link
Contributor

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

@ani300 ani300 requested review from cpuhrsch and mikekgfb November 1, 2022 17:27
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are these changes needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The compiler started complaining for some reason.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to rely on _nested_tensor_from_tensor_list for all the dtype, device, etc. checks?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Looking at the implementation for both torch::tensor() and _nested_tensor_from_tensor_list, we do the same amount of checks

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, but this could deduplicate code

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I don't think you should need this check

>>> torch.nested.nested_tensor([])
nested_tensor([

])

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is for the C++ path, given that python now takes python vars it needs different impls (or at least torch::tensor does so)

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: when using _add_docstr, in order to render the arguments for the function a line containing the signature of the function needs to be added here (see to_padded_tensor above for an example)

(the preview for the docs is available under helpful links in the pytorch-bot comment on this PR if you would like to look at the rendering!)

@facebook-github-bot
Copy link
Contributor

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

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

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

…nsor() (pytorch#88213)

Summary:
Pull Request resolved: pytorch#88213

This diff merges both previous implementations of constructors for nested tensors, the one from lists of tensors and the one with arbitrary python lists, adn implements it in pytorch core so no extensions are needed to construct NT.

Test Plan:
All nested tensor tests pass successfully. Specifically:

`buck test mode/dev-nosan //caffe2/test:nested`

Reviewed By: cpuhrsch, mikekgfb

Differential Revision: D40878312

fbshipit-source-id: e9f36fa66287299efc144c45b65a8f6cbe248ca3
@facebook-github-bot
Copy link
Contributor

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

@ani300
Copy link
Collaborator Author

ani300 commented Nov 7, 2022

@pytorchbot merge -g

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Nov 7, 2022
@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: This PR has internal changes and must be landed via Phabricator

Details for Dev Infra team Raised by workflow job

@cpuhrsch
Copy link
Contributor

cpuhrsch commented Nov 7, 2022

@pytorchbot merge -g

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks on your PR pass since you used the green (-g) flag (ETA: 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

kulinseth pushed a commit to kulinseth/pytorch that referenced this pull request Dec 10, 2022
…nsor() (pytorch#88213)

Summary: This diff merges both previous implementations of constructors for nested tensors, the one from lists of tensors and the one with arbitrary python lists, adn implements it in pytorch core so no extensions are needed to construct NT.

Pull Request resolved: pytorch#88213
Approved by: https://github.com/cpuhrsch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request fb-exported Merged release notes: cpp release notes category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants