pytorch/docs/cpp/source
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
..
_static Fix overlapping keywords (#34142) 2020-03-06 19:16:21 -08:00
notes Improve C++ API autograd and indexing docs (#35777) 2020-04-02 09:33:11 -07:00
check-doxygen.sh Move glu to Aten(CPU) (#33179) 2020-02-28 14:54:38 -08:00
conf.py Document IValue (#31904) 2020-01-08 16:08:35 -08:00
Doxyfile Put TORCH_LIBRARY in torch/library.h; add custom class API (#36742) 2020-04-21 10:05:21 -07:00
frontend.rst Docs: c++11 -> c++14 (#30530) 2019-12-17 14:09:02 -08:00
index.rst Synchronize with ShipIt. 2020-01-21 13:39:28 -05:00
installing.rst Back out "Revert D17908478: Switch PyTorch/Caffe2 to C++14" 2019-12-03 14:33:43 -08:00