pytorch/tools/code_analyzer
Edward Yang 01100cb477 Put TORCH_LIBRARY in torch/library.h; add custom class API (#36742)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/36742

Now, you can define a custom class inside a TORCH_LIBRARY block.
It looks very similar to what you did before.  Instead of

```
static auto m = torch::class_<Class>("Namespace", "Class").def("foo", foo);
```

you write

```
TORCH_LIBRARY(Namespace, m) {
  m.class_<Class>("Class")
    .def("foo", foo);
}
```

All the old usages still work, but at some point we should start
updating the tutorials when we're ready to go 100% live with the
new pybind11 style API.

custom class API previously lived in torch/ folder and in torch
namespace, so for consistency, the new TORCH_LIBRARY also got
moved to torch/library.h The definition of Library::class_ is in the
bottom of that header because I need all of the class_ constructors
available, but there is a circular dependency between the two headers.

Signed-off-by: Edward Z. Yang <ezyang@fb.com>

Differential Revision: D21089648

Test Plan: Imported from OSS

Pulled By: ezyang

fbshipit-source-id: 8d54329c125242605336c22fa1642aae6940b507
2020-04-21 10:05:21 -07:00
..
analyzer.cpp [pytorch] convert code analyzer to a binary (#33102) 2020-02-10 14:46:29 -08:00
build.sh [RELAND] Add DispatchKey impl overload; remove use of torch::dispatch (#36222) 2020-04-09 14:56:55 -07:00
CMakeLists.txt [pytorch] convert code analyzer to a binary (#33102) 2020-02-10 14:46:29 -08:00
gen_op_registration_whitelist.py [pytorch] improve code analyzer to dump ops called from c++ functions (#35941) 2020-04-14 23:21:19 -07:00
op_dependency.cpp [pytorch] handle pybind11 style registration API with code analyzer (#36607) 2020-04-15 11:03:41 -07:00
run_analyzer.sh Put TORCH_LIBRARY in torch/library.h; add custom class API (#36742) 2020-04-21 10:05:21 -07:00