pytorch/test/cpp/api
Wanchao Liang 8756ec989e bind autograd functions into C++ (#24342)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/24342

Right now the two APIs that provided in autograd package only have
python bindings and we could not call them either in C++ API or in
TorchScript. This PR make these two APIs available purely in C++ (with
preserving semantics) and can be used in C++ API and TorchScript

Differential Revision: D16923271

fbshipit-source-id: 049d6fbd94cd71ecc08b2716f74d52ac061f861e
2019-08-20 15:36:34 -07:00
..
any.cpp
autograd.cpp bind autograd functions into C++ (#24342) 2019-08-20 15:36:34 -07:00
CMakeLists.txt C++ ModuleList 2019-08-19 10:02:40 -07:00
dataloader.cpp add sorting policy to ChunkDataset (#23053) 2019-07-29 12:34:02 -07:00
expanding-array.cpp
init.cpp
init_baseline.h
init_baseline.py
integration.cpp
jit.cpp Add Pickler C++ API (#23241) 2019-08-12 14:43:31 -07:00
memory.cpp
misc.cpp
module.cpp Avoid unnecessary tensor clone in Cloneable (#20995) 2019-07-26 12:46:42 -07:00
modulelist.cpp C++ ModuleList 2019-08-19 10:02:40 -07:00
modules.cpp
optim.cpp
optim_baseline.h
optim_baseline.py
ordered_dict.cpp
parallel.cpp Fix C++ data parallel (#20910) 2019-06-06 11:57:31 -07:00
README.md
rnn.cpp Bidirectional GRU and LSTM C++ API forward fix (#22850) 2019-07-22 12:59:47 -07:00
sequential.cpp Include named_any.h in modules.h (#21437) 2019-06-06 09:57:33 -07:00
serialize.cpp Ignore nn::Functional submodules in nn::Module serialization (#19740) 2019-04-26 12:47:23 -07:00
static.cpp
support.h
tensor.cpp Templatize Tensor.data_ptr() (#24847) 2019-08-19 17:02:18 -07:00
tensor_cuda.cpp
tensor_options.cpp Revert D15920763: Move TensorOptions to ATen/core 2019-08-13 12:07:18 -07:00
tensor_options_cuda.cpp Revert D15920763: Move TensorOptions to ATen/core 2019-08-13 12:07:18 -07:00
torch_include.cpp Add get/set_num_interop_threads into torch.h include (#20659) 2019-05-20 00:34:59 -07:00

C++ Frontend Tests

In this folder live the tests for PyTorch's C++ Frontend. They use the GoogleTest test framework.

CUDA Tests

To make a test runnable only on platforms with CUDA, you should suffix your test with _CUDA, e.g.

TEST(MyTestSuite, MyTestCase_CUDA) { }

To make it runnable only on platforms with at least two CUDA machines, suffix it with _MultiCUDA instead of _CUDA, e.g.

TEST(MyTestSuite, MyTestCase_MultiCUDA) { }

There is logic in main.cpp that detects the availability and number of CUDA devices and supplies the appropriate negative filters to GoogleTest.

Integration Tests

Integration tests use the MNIST dataset. You must download it by running the following command from the PyTorch root folder:

$ python tools/download_mnist.py -d test/cpp/api/mnist

The required paths will be referenced as test/cpp/api/mnist/... in the test code, so you must run the integration tests from the PyTorch root folder.