Attribute serialization improvements (#18188)
authorDavid Riazati <davidriazati@fb.com>
Sat, 30 Mar 2019 02:06:06 +0000 (19:06 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Sat, 30 Mar 2019 02:10:12 +0000 (19:10 -0700)
commit24db1667daeb84a9eb351ec6b6264de22213a910
tree59af453861a2d2ec37eeb20224facc075a0c1341
parente13101e0691b0eabc1900f482a615ea7f14e7a72
Attribute serialization improvements (#18188)

Summary:
* adds attributes to `ScriptModule.__getattr__` so they can be accessed in Python after re-importing
* full support for all the possible values for an `int64_t`
    * this necessitated a bunch more `pushWhatever` functions, so re-introduced a templated version to cut down on duplicate code
* tests to validate references / value sharing works
* adds `torch.jit.Unpickler` which people can use to de-serialize the pickle files into Python / have a quick reference on how to do this without PyTorch
Pull Request resolved: https://github.com/pytorch/pytorch/pull/18188

Differential Revision: D14527490

Pulled By: driazati

fbshipit-source-id: efd15579cc04aa2e28c4b2c9490d82d849dee559
test/test_jit.py
torch/_six.py
torch/csrc/jit/passes/python_print.cpp
torch/csrc/jit/pickler.cpp
torch/csrc/jit/pickler.h
torch/csrc/jit/script/init.cpp
torch/csrc/jit/script/module.h
torch/jit/__init__.py
torch/jit/_pickle.py [new file with mode: 0644]