pytorch/torch/csrc/jit/python
Zachary DeVito 60518d10f6 [deploy] torch::deploy API (#51754)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/51754

This API allows you to manage multiple python interpreters in a single
process to deploy PyTorch models packaged with torch.package.

torch/csrc/deploy/deploy.h contains the API definition
torch/csrc/deploy/test_deploy.cpp has some examples.

Notes:
* mutex is added to PyTorchStreamReader to make it safe to use from multiple threads at once.
* USE_DEPLOY is only true for the special libtorch_deployinterpreter.so library, when enabled
  we use a hash table to maintain PyObject <> at::Tensor mappping rather than the internal pointer
  in Tensor since >1 interpreter may have a reference to the tensor.
* serialization.py has some additional functions for creating pickle objects
  but keeping storages in memory for use transfering tensors between interpreters

Test Plan: Imported from OSS

Reviewed By: wconstab

Differential Revision: D26329468

Pulled By: zdevito

fbshipit-source-id: d75f4ebb9a27f1d911179d9996041bcb3ca04a07
2021-02-18 02:30:08 -08:00
..
init.cpp [deploy] torch::deploy API (#51754) 2021-02-18 02:30:08 -08:00
init.h
module_python.h
pybind.h
pybind_utils.cpp
pybind_utils.h
python_arg_flatten.cpp
python_arg_flatten.h
python_custom_class.cpp [JIT] Add static method support for TorchBind (#51177) 2021-02-13 19:41:27 -08:00
python_custom_class.h
python_interpreter.cpp
python_ir.cpp Keep alive graph when creating iterators from it (#51951) 2021-02-10 11:09:51 -08:00
python_ir.h
python_ivalue.h
python_sugared_value.cpp [JIT] Add static method support for TorchBind (#51177) 2021-02-13 19:41:27 -08:00
python_sugared_value.h
python_tracer.cpp [Usability] Capture argument names for traced functions and modules (#51775) 2021-02-10 18:28:08 -08:00
python_tracer.h [Usability] Capture argument names for traced functions and modules (#51775) 2021-02-10 18:28:08 -08:00
python_tree_views.cpp
python_tree_views.h
script_init.cpp [WIP] Add a _flush_compilation_cache for testing (#52001) 2021-02-16 10:49:38 -08:00
script_init.h
update_graph_executor_opt.cpp
update_graph_executor_opt.h