pytorch/test/cpp/api
Edward Yang 0ff1bb0d8a Remove Type constructor from TensorOptions, add Type::options (#11189)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/11189

Replaces it with an operator TensorOptions() method on
Type, reestablishing the implicit conversion.  I originally
wanted to get rid of the implicit conversion entirely, but
there were a *lot* of use-sites, so I added it back to avoid
a huge codemod.  In this patch, I only had to fix sites that
used the optional device_index API.

Reviewed By: cpuhrsch

Differential Revision: D9628281

fbshipit-source-id: 5fe2a68eefb77a3c9bb446f03a94ad723ef90210
2018-09-04 08:10:04 -07:00
..
any.cpp Make torch::Tensor -> at::Tensor (#10516) 2018-08-15 21:25:12 -07:00
cursor.cpp Add OptimizerBase::add_parameters (#9472) 2018-07-17 14:10:22 -07:00
integration.cpp Refactor Device to not depend on Backend. (#10478) 2018-08-18 17:39:14 -07:00
main.cpp Functional DataParallel (#9234) 2018-07-19 16:12:04 -07:00
misc.cpp Update include paths for ATen/core (#10130) 2018-08-03 11:57:02 -07:00
module.cpp Make torch::Tensor -> at::Tensor (#10516) 2018-08-15 21:25:12 -07:00
modules.cpp Make torch::Tensor -> at::Tensor (#10516) 2018-08-15 21:25:12 -07:00
optim_baseline.h Remove use of data() in optimizers (#10490) 2018-08-14 13:10:19 -07:00
optim_baseline.py Remove use of data() in optimizers (#10490) 2018-08-14 13:10:19 -07:00
optim.cpp Remove use of data() in optimizers (#10490) 2018-08-14 13:10:19 -07:00
parallel.cpp Make torch::Tensor -> at::Tensor (#10516) 2018-08-15 21:25:12 -07:00
README.md Update C++ API tests to use Catch2 (#7108) 2018-04-30 21:36:35 -04:00
rnn.cpp Use ATen implementation of RNNs (#10761) 2018-08-23 16:12:14 -07:00
sequential.cpp Make torch::Tensor -> at::Tensor (#10516) 2018-08-15 21:25:12 -07:00
serialization.cpp Add complex32, complex64 and complex128 dtypes (#11173) 2018-09-03 19:19:36 -07:00
static.cpp Make Sequential ref-counted (#9151) 2018-07-11 17:24:59 -07:00
tensor_cuda.cpp Functional DataParallel (#9234) 2018-07-19 16:12:04 -07:00
tensor_options_cuda.cpp Remove Type constructor from TensorOptions, add Type::options (#11189) 2018-09-04 08:10:04 -07:00
tensor_options.cpp Get rid of type() method on TensorOptions; use at::getType instead (#11023) 2018-08-31 14:27:05 -07:00
tensor.cpp Remove Tensor constructor of Scalar. (#10852) 2018-08-24 16:02:05 -07:00
util.h Make torch::Tensor -> at::Tensor (#10516) 2018-08-15 21:25:12 -07:00

C++ API Tests

In this folder live the tests for PyTorch's C++ API (formerly known as autogradpp). They use the Catch2 test framework.

CUDA Tests

The way we handle CUDA tests is by separating them into a separate TEST_CASE (e.g. we have optim and optim_cuda test cases in optim.cpp), and giving them the [cuda] tag. Then, inside main.cpp we detect at runtime whether CUDA is available. If not, we disable these CUDA tests by appending ~[cuda] to the test specifications. The ~ disables the tag.

One annoying aspect is that Catch only allows filtering on test cases and not sections. Ideally, one could have a section like LSTM inside the RNN test case, and give this section a [cuda] tag to only run it when CUDA is available. Instead, we have to create a whole separate RNN_cuda test case and put all these CUDA sections in there.

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