pytorch/torch/csrc/jit/script
Zachary DeVito 44fb23a2f5 Add ability to annotate jit types inside function (#13752)
Summary:
This adds torch.jit.annotate for annotating the type of an intermediate.
This is Py2/3 compatible, e.g.:

```
from torch.jit import annotate
from typing import List

torch.jit.script
def foo():
  a = annotate(List[int], [])
```

This is needed to output valid python programs from our IR. It removes
the need for the empty list constructors.

A future patch can add support to the C++ parser and Python 3,
via desugaring:

```
a : int = b
a = anntoate(int, b)
```

But this functionality is not required for serialization so is not added in this patch.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13752

Differential Revision: D12989885

Pulled By: zdevito

fbshipit-source-id: 161573a7352094543dc0d33a892f2a3b9103d847
2018-11-08 20:25:00 -08:00
..
builtin_functions.cpp Add builtins for size() and list with defaults (#13639) 2018-11-08 11:26:35 -08:00
builtin_functions.h Introduce builtin script functions (#12141) 2018-09-28 10:55:08 -07:00
compiler.cpp Add ability to annotate jit types inside function (#13752) 2018-11-08 20:25:00 -08:00
compiler.h Add ability to annotate jit types inside function (#13752) 2018-11-08 20:25:00 -08:00
error_report.h Add modernize-* checks to clang-tidy (#13196) 2018-11-02 20:30:40 -07:00
init.cpp Add ability to annotate jit types inside function (#13752) 2018-11-08 20:25:00 -08:00
init.h [jit] Have ScriptModule inherit from Module (#5769) 2018-03-22 00:17:49 -04:00
jit_exception.h First step at adding exceptions (#12789) 2018-10-30 20:25:50 -07:00
lexer.cpp Add operator is, not, is not to script (#13336) 2018-11-01 16:55:28 -07:00
lexer.h Add pass support to script (#13535) 2018-11-05 17:13:06 -08:00
module.cpp Change return type of Tensor::dtype() from ScalarType to TypeMeta (#12766) 2018-10-26 09:27:09 -07:00
module.h Tracer now records Python variable names (#13441) 2018-11-08 13:08:42 -08:00
parser.h Fix a bug in tuple assignment (#13656) 2018-11-07 16:44:22 -08:00
python_tree_views.cpp Fix a bug in tuple assignment (#13656) 2018-11-07 16:44:22 -08:00
python_tree_views.h Add workaround to fix include warnings in Python 2 builds. (#6716) 2018-04-24 12:30:19 -07:00
tree_views.h Fix a bug in tuple assignment (#13656) 2018-11-07 16:44:22 -08:00
tree.h Add modernize-* checks to clang-tidy (#13196) 2018-11-02 20:30:40 -07:00