tree: 55abbde4de389e266099fe27620b4a8f1bb5504c [path history] [tgz]
  1. any.cpp
  2. autograd.cpp
  3. CMakeLists.txt
  4. dataloader.cpp
  5. expanding-array.cpp
  6. init.cpp
  7. init_baseline.h
  8. init_baseline.py
  9. integration.cpp
  10. jit.cpp
  11. memory.cpp
  12. misc.cpp
  13. module.cpp
  14. modulelist.cpp
  15. modules.cpp
  16. optim.cpp
  17. optim_baseline.h
  18. optim_baseline.py
  19. ordered_dict.cpp
  20. parallel.cpp
  21. README.md
  22. rnn.cpp
  23. sequential.cpp
  24. serialize.cpp
  25. static.cpp
  26. support.h
  27. tensor.cpp
  28. tensor_cuda.cpp
  29. tensor_options.cpp
  30. tensor_options_cuda.cpp
  31. torch_include.cpp
test/cpp/api/README.md

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.