Skip to content

[jit] Add resolver for 'torch' module#10847

Closed
driazati wants to merge 4 commits intopytorch:masterfrom
driazati:cpp_script
Closed

[jit] Add resolver for 'torch' module#10847
driazati wants to merge 4 commits intopytorch:masterfrom
driazati:cpp_script

Conversation

@driazati
Copy link
Contributor

@driazati driazati commented Aug 24, 2018

This lets you compile builtin functions from C++ without having a dependence on Python

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

@zou3519 zou3519 added the oncall: jit Add this issue/PR to JIT oncall triage queue label Aug 28, 2018
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

goldsborough has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@goldsborough goldsborough left a comment

Choose a reason for hiding this comment

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

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

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@driazati driazati requested a review from ebetica as a code owner August 29, 2018 20:15
@driazati
Copy link
Contributor Author

The latest commit pulls the functionality out of torch/jit and into the C++ API with compile and run functions.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@driazati
Copy link
Contributor Author

driazati commented Sep 3, 2018

@pytorchbot retest this please

Copy link
Contributor

@goldsborough goldsborough left a comment

Choose a reason for hiding this comment

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

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

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

driazati has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

David Riazati added 4 commits September 5, 2018 16:45
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:
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

driazati is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

PenghuiCheng pushed a commit to PenghuiCheng/pytorch that referenced this pull request Sep 11, 2018
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
@ezyang ezyang added the merged label Jun 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

oncall: jit Add this issue/PR to JIT oncall triage queue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants