pytorch/test/cpp/api
linhaifeng 695cb0d342 [2/N][Fix] Fix typo in test folder (#166374)
Fix typo in test folder.

_typos.toml
```bash
[default.extend-words]
nd = "nd"
arange = "arange"
Nd = "Nd"
GLOBALs = "GLOBALs"
hte = "hte"
iy = "iy"
PN = "PN"
Dout = "Dout"
optin = "optin"
gam = "gam"
PTD = "PTD"
```

Pull Request resolved: https://github.com/pytorch/pytorch/pull/166374
Approved by: https://github.com/cyyever, https://github.com/ezyang
2025-10-29 03:02:07 +00:00
..
any.cpp
autograd.cpp [2/N][Fix] Fix typo in test folder (#166374) 2025-10-29 03:02:07 +00:00
CMakeLists.txt Fix some CMake issues (#153686) 2025-05-19 00:31:34 +00:00
dataloader.cpp [Lint] Update clang-format to 19.1.4 (#153889) 2025-05-20 14:12:46 +00:00
dispatch.cpp
enum.cpp
expanding-array.cpp
fft.cpp
functional.cpp
grad_mode.cpp
inference_mode.cpp
init_baseline.h
init_baseline.py
init.cpp
integration.cpp
ivalue.cpp
jit.cpp
memory.cpp
meta_tensor.cpp
misc.cpp
module.cpp
moduledict.cpp
modulelist.cpp
modules.cpp [2/N] Fix cppcoreguidelines-init-variables suppression (#146237) 2025-06-19 23:26:42 +00:00
namespace.cpp
nested_int.cpp
nested.cpp
nn_utils.cpp
operations.cpp
optim_baseline.h
optim_baseline.py
optim.cpp Revert "C++ API handle optimizer defaults (#161825)" 2025-10-10 17:56:11 +00:00
ordered_dict.cpp
parallel_benchmark.cpp
parallel.cpp [2/N][Fix] Fix typo in test folder (#166374) 2025-10-29 03:02:07 +00:00
parameterdict.cpp
parameterlist.cpp
README.md
rnn.cpp
sequential.cpp
serialize.cpp
special.cpp
static.cpp
support.cpp
support.h
tensor_cuda.cpp Feature: Implement support for cudnn_batch_norm_out kernel to replace the autogen approach. (#123020) 2025-08-04 22:40:33 +00:00
tensor_flatten.cpp
tensor_indexing.cpp
tensor_options_cuda.cpp
tensor_options.cpp
tensor.cpp [Lint] Update clang-format to 19.1.4 (#153889) 2025-05-20 14:12:46 +00:00
torch_include.cpp
transformer.cpp [BE][3/6] fix typos in test/ (#157637) 2025-07-17 12:08:33 +00: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.