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

NumPy support in TorchDynamo #54

Merged
merged 5 commits into from
Aug 11, 2023
Merged

Conversation

lezcano
Copy link
Contributor

@lezcano lezcano commented Apr 28, 2023

This RFC proposes a design and implementation for a translation layer from NumPy to PyTorch. This is currently implemented at numpy_pytorch_interop.

We leave an open question in the section "Unresolved Questions" regarding whether this API should also be public or not.

RFC-0032-numpy-support-in-dynamo.md Show resolved Hide resolved
RFC-0032-numpy-support-in-dynamo.md Outdated Show resolved Hide resolved
RFC-0032-numpy-support-in-dynamo.md Show resolved Hide resolved
RFC-0032-numpy-support-in-dynamo.md Show resolved Hide resolved
RFC-0032-numpy-support-in-dynamo.md Show resolved Hide resolved
RFC-0032-numpy-support-in-dynamo.md Outdated Show resolved Hide resolved
RFC-0032-numpy-support-in-dynamo.md Outdated Show resolved Hide resolved
guarantees when it comes to randomness.

**Accuracy**. For deterministic operations, we would expect to give accuracy
guarantees similar to those in PyTorch 2.0. In particular, we would expect
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: torch.compile

@lezcano
Copy link
Contributor Author

lezcano commented Jul 28, 2023

A PR is up: pytorch/pytorch#106211

pytorchmergebot pushed a commit to pytorch/pytorch that referenced this pull request Aug 11, 2023
RFC: pytorch/rfcs#54
First commit is the contents of https://github.com/Quansight-Labs/numpy_pytorch_interop/

We have already been using this in core for the last few months as a external dependency. This PR pulls all these into core.

In the next commits, I do a number of things in this order
- Fix a few small issues
- Make the tests that this PR adds pass
- Bend backwards until lintrunner passes
- Remove the optional dependency on `torch_np` and simply rely on the upstreamed code
- Fix a number dynamo tests that were passing before (they were not tasting anything I think) and are not passing now.

Missing from this PR (but not blocking):
- Have a flag that deactivates tracing NumPy functions and simply breaks. There used to be one but after the merge stopped working and I removed it. @lezcano to investigate.
- #106431 (comment). @voznesenskym to submit a fix after we merge.

All the tests in `tests/torch_np` take about 75s to run.

This was a work by @ev-br, @rgommers @honno and I. I did not create this PR via ghstack (which would have been convenient) as this is a collaboration, and ghstack doesn't allow for shared contributions.

Pull Request resolved: #106211
Approved by: https://github.com/ezyang
@lezcano
Copy link
Contributor Author

lezcano commented Aug 11, 2023

The PR upstreaming this work was merged yesterday. Could you please merge this one @albanD ?

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

Successfully merging this pull request may close these issues.

3 participants