pytorch/test/cpp/api
Kurt Mohler 3ddc6174da Raise error in clip_grad_norm_ if norm is non-finite (#53843)
Summary:
**BC-breaking note**: This change throws errors for cases that used to silently pass. The old behavior can be obtained by setting `error_if_nonfinite=False`

Fixes https://github.com/pytorch/pytorch/issues/46849

Pull Request resolved: https://github.com/pytorch/pytorch/pull/53843

Reviewed By: malfet

Differential Revision: D27291838

Pulled By: jbschlosser

fbshipit-source-id: 216d191b26e1b5919a44a3af5cde6f35baf825c4
2021-03-29 08:41:21 -07:00
..
any.cpp
autograd.cpp Fix autograd when inputs contains tensors without materialized grad_fn (#51940) 2021-02-11 09:22:15 -08:00
CMakeLists.txt Implement public API InferenceMode and its error handling (#53343) 2021-03-27 13:44:23 -07:00
dataloader.cpp Forbid trailing whitespace (#53406) 2021-03-05 17:22:55 -08:00
dispatch.cpp
enum.cpp
expanding-array.cpp
fft.cpp
functional.cpp Forbid trailing whitespace (#53406) 2021-03-05 17:22:55 -08:00
grad_mode.cpp Implement public API InferenceMode and its error handling (#53343) 2021-03-27 13:44:23 -07:00
inference_mode.cpp Implement public API InferenceMode and its error handling (#53343) 2021-03-27 13:44:23 -07:00
init.cpp
init_baseline.h
init_baseline.py
integration.cpp
jit.cpp
memory.cpp
misc.cpp
module.cpp
moduledict.cpp
modulelist.cpp
modules.cpp Add padding='same' mode to conv{1,2,3}d (#45667) 2021-03-18 16:22:03 -07:00
namespace.cpp
nn_utils.cpp Raise error in clip_grad_norm_ if norm is non-finite (#53843) 2021-03-29 08:41:21 -07:00
operations.cpp
optim.cpp Adding learning rate schedulers to C++ API (#52268) 2021-03-10 23:09:51 -08:00
optim_baseline.h
optim_baseline.py
ordered_dict.cpp
parallel.cpp
parallel_benchmark.cpp
parameterdict.cpp
parameterlist.cpp
README.md
rnn.cpp
sequential.cpp
serialize.cpp
special.cpp [special] add torch.special namespace (#52296) 2021-03-04 00:04:36 -08:00
static.cpp
support.cpp
support.h Implement public API InferenceMode and its error handling (#53343) 2021-03-27 13:44:23 -07:00
tensor.cpp
tensor_cuda.cpp
tensor_flatten.cpp
tensor_indexing.cpp
tensor_options.cpp
tensor_options_cuda.cpp
torch_include.cpp
transformer.cpp

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.