[jit] Add resolver for 'torch' module#10847
[jit] Add resolver for 'torch' module#10847driazati wants to merge 4 commits intopytorch:masterfrom driazati:cpp_script
Conversation
facebook-github-bot
left a comment
There was a problem hiding this comment.
goldsborough has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
goldsborough
left a comment
There was a problem hiding this comment.
The implementation of compileFunction looks great, but it needs more documentation and possibly some usability improvements for running the function. We want to expose this method to public C++ users so it should be easy to use
torch/csrc/jit/script/compiler.cpp
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torch/csrc/jit/script/compiler.h
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torch/csrc/jit/script/compiler.h
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torch/csrc/jit/test_jit.cpp
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
The latest commit pulls the functionality out of |
torch/csrc/api/include/torch/jit.h
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torch/csrc/api/include/torch/jit.h
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torch/csrc/api/include/torch/jit.h
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torch/csrc/api/include/torch/jit.h
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torch/csrc/api/include/torch/jit.h
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torch/csrc/jit/script/compiler.h
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torch/csrc/api/include/torch/jit.h
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
test/cpp/api/jit.cpp
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torch/csrc/api/include/torch/jit.h
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
@pytorchbot retest this please |
goldsborough
left a comment
There was a problem hiding this comment.
I made some small suggestions that improve legibility/correctness, but they're nits. You can address them if you want, otherwise feel free to land already
torch/csrc/api/src/jit.cpp
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torch/csrc/api/include/torch/jit.h
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torch/csrc/jit/script/compiler.h
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
torch/csrc/jit/script/compiler.h
Outdated
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
facebook-github-bot
left a comment
There was a problem hiding this comment.
driazati has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Summary: This lets you use builtin functions from C++ without having a dependence on Python Test Plan: Reviewers: Subscribers: Tasks: Tags:
Summary:
* Adds jit.h and jit.cpp to csrc/api
* Adds torch::jit::compile and torch::jit::run methods to expose
script compiler and interpreter to C++ users
* Add test_api test for JIT API
Test Plan:
`./build/bin/test_api "torch script"`
Reviewers:
Subscribers:
Tasks:
Tags:
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags:
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags:
facebook-github-bot
left a comment
There was a problem hiding this comment.
driazati is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Summary:
This lets you compile builtin functions from C++ without having a dependence on Python
```cpp
auto module = torch::jit::compile(JIT"(
def my_script_method(x, y):
return torch.relu(x) + y
)");
IValue result = module->run_method("my_script_method", 1, 2);
```
goldsborough zdevito apaszke
Pull Request resolved: pytorch#10847
Differential Revision: D9543461
Pulled By: driazati
fbshipit-source-id: 6160dae094030ca144a0df93cb9f26aa78c8cf27
This lets you compile builtin functions from C++ without having a dependence on Python
@goldsborough @zdevito @apaszke