pytorch/test/cpp/api
Charles Hofer 5fd037ce44 Fix MagmaInitializesCorrectly_CUDA by using an invertible matrix (#32547)
Summary:
This test case had been using the tensor

```
1  2  3  4
5  6  7  8
9  10 11 12
13 14 15 16
```

which is not an invertible tensor and causes the test case to fail, even if magma gets initialized just fine. This change uses a tensor that is invertible, and the inverse doesn't include any elements that are close to zero to avoid floating point rounding errors.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/32547

Differential Revision: D19572316

Pulled By: ngimel

fbshipit-source-id: 1baf3f8601b2ba69fdd6678d7a3d86772d01edbe
2020-01-25 20:00:54 -08:00
..
any.cpp Remove dead includes in caffe2/test 2020-01-21 11:30:34 -08:00
autograd.cpp Fix bugs in torch::tensor constructor (#28523) 2019-10-31 12:53:06 -07:00
CMakeLists.txt C++ tensor indexing: add Slice / TensorIndex (#30424) 2020-01-10 17:53:41 -08:00
dataloader.cpp Fix typos (#30606) 2019-12-02 20:17:42 -08:00
enum.cpp Use c10::variant-based enums for F::grid_sample 2019-11-12 16:05:26 -08:00
expanding-array.cpp
functional.cpp Remove dead includes in caffe2/test 2020-01-21 11:30:34 -08:00
init.cpp Make autogen functions correct for multiple outputs and views (#31990) 2020-01-24 14:32:28 -08:00
init_baseline.h
init_baseline.py
integration.cpp C++ API parity: Dropout, Dropout2d, Dropout3d 2019-11-15 20:32:06 -08:00
jit.cpp
memory.cpp
misc.cpp
module.cpp Remove dead includes in caffe2/test 2020-01-21 11:30:34 -08:00
modulelist.cpp C++ API parity: Dropout, Dropout2d, Dropout3d 2019-11-15 20:32:06 -08:00
modules.cpp Remove dead includes in caffe2/test 2020-01-21 11:30:34 -08:00
nn_utils.cpp Remove dead includes in caffe2/test 2020-01-21 11:30:34 -08:00
optim.cpp Adagrad optimizer - updated step function, added param_groups, state to optimizers 2020-01-21 14:41:12 -08:00
optim_baseline.h
optim_baseline.py
ordered_dict.cpp
parallel.cpp Fix bugs in torch::tensor constructor (#28523) 2019-10-31 12:53:06 -07:00
README.md
rnn.cpp Fix typos, via a Levenshtein-type corrector (#31523) 2020-01-17 16:03:19 -08:00
sequential.cpp C++ API parity: Dropout, Dropout2d, Dropout3d 2019-11-15 20:32:06 -08:00
serialize.cpp Adagrad optimizer - updated step function, added param_groups, state to optimizers 2020-01-21 14:41:12 -08:00
static.cpp
support.cpp Use default dtype for torch::tensor(floating_point_values) and torch::tensor(empty braced-init-list) when dtype is not specified (#29632) 2019-11-13 15:17:11 -08:00
support.h Exclude undefined tensors in the result of Module::parameters() / named_paramters() / buffers() / named_buffers() (#30626) 2019-12-02 21:59:58 -08:00
tensor.cpp For torch::from_blob() add clue when memory is non-owned. (#31222) 2020-01-07 13:12:30 -08:00
tensor_cuda.cpp Fix MagmaInitializesCorrectly_CUDA by using an invertible matrix (#32547) 2020-01-25 20:00:54 -08:00
tensor_indexing.cpp Fix typo in config script to re-enable libtorch build and test in macOS CI (#32072) 2020-01-14 16:23:57 -08:00
tensor_options.cpp Deprecate tensor.type() (#30281) 2019-12-05 10:55:34 -08:00
tensor_options_cuda.cpp Deprecate tensor.type() (#30281) 2019-12-05 10:55:34 -08:00
torch_include.cpp Relax set_num_threads restriction in parallel native case (#27947) 2019-10-16 21:53:36 -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.