Summary: This is along the way of removing Tensor as a member of the tagged union in Scalar. This simplifies ordering dependencies, because currently Scalar and Tensor both depend on each other (so we introduce a TensorBase). Also, this API isn't particularly useful publicly: we can't autograd through Scalars, so you still need a Tensor overload basically everywhere anyway. I'm undecided what the final API should be here. We could keep a Tensor constructor on Scalar, but have it generate a local scalar; this is convenient but given this API used to be non-synchronizing, it may not be the best. For now, I'm just using _local_scalar, which is clear, although we should get rid of the prefix _ if that's the API we intend to promote. Pull Request resolved: https://github.com/pytorch/pytorch/pull/10852 Reviewed By: ezyang Differential Revision: D9496766 Pulled By: gchanan fbshipit-source-id: 16f39b57536b9707132a5a4d915650c381bb57db |
||
|---|---|---|
| .. | ||
| any.cpp | ||
| cursor.cpp | ||
| integration.cpp | ||
| main.cpp | ||
| misc.cpp | ||
| module.cpp | ||
| modules.cpp | ||
| optim_baseline.h | ||
| optim_baseline.py | ||
| optim.cpp | ||
| parallel.cpp | ||
| README.md | ||
| rnn.cpp | ||
| sequential.cpp | ||
| serialization.cpp | ||
| static.cpp | ||
| tensor_cuda.cpp | ||
| tensor_options_cuda.cpp | ||
| tensor_options.cpp | ||
| tensor.cpp | ||
| util.h | ||
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