pytorch/test/cpp/api
Jeffrey Wan f5073b0c5a Add inputs argument to autograd.backward() (#46855)
Summary:
Fixes https://github.com/pytorch/pytorch/issues/46373

As noted in https://github.com/pytorch/pytorch/issues/46373, there needs to be a flag passed into the engine that indicates whether it was executed through the backward api or grad api. Tentatively named the flag `accumulate_grad` since functionally, backward api accumulates grad into .grad while grad api captures the grad and returns it.

Moving changes not necessary to the python api (cpp, torchscript) to a new PR.

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

Reviewed By: ngimel

Differential Revision: D24649054

Pulled By: soulitzer

fbshipit-source-id: 6925d5a67d583eeb781fc7cfaec807c410e1fc65
2020-11-02 14:32:38 -08:00
..
any.cpp
autograd.cpp Add inputs argument to autograd.backward() (#46855) 2020-11-02 14:32:38 -08:00
CMakeLists.txt C++ API TransformerEncoderLayer (#42633) 2020-08-07 11:49:42 -07:00
dataloader.cpp
dispatch.cpp
enum.cpp
expanding-array.cpp
fft.cpp Add one dimensional FFTs to torch.fft namespace (#43011) 2020-09-19 23:32:22 -07:00
functional.cpp [c++] Distance-agnostic triplet margin loss (#45377) 2020-09-30 12:37:35 -07:00
init.cpp
init_baseline.h
init_baseline.py
integration.cpp
jit.cpp
memory.cpp
misc.cpp
module.cpp
modulelist.cpp
modules.cpp [c++] Distance-agnostic triplet margin loss (#45377) 2020-09-30 12:37:35 -07:00
namespace.cpp
nn_utils.cpp
operations.cpp [Codemod][GleanFbcode] Remove dead includes in caffe2/test (#43953) 2020-09-01 21:48:28 -07:00
optim.cpp
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
static.cpp
support.cpp
support.h
tensor.cpp
tensor_cuda.cpp
tensor_indexing.cpp
tensor_options.cpp
tensor_options_cuda.cpp
torch_include.cpp
transformer.cpp C++ APIs Transformer NN Module Top Layer (#44333) 2020-09-11 08:25:27 -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.