pytorch/test/cpp/api
Gregory Chanan 87a7840fa6 Remove Tensor constructor of Scalar. (#10852)
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
2018-08-24 16:02:05 -07:00
..
any.cpp Make torch::Tensor -> at::Tensor (#10516) 2018-08-15 21:25:12 -07:00
cursor.cpp Add OptimizerBase::add_parameters (#9472) 2018-07-17 14:10:22 -07:00
integration.cpp Refactor Device to not depend on Backend. (#10478) 2018-08-18 17:39:14 -07:00
main.cpp Functional DataParallel (#9234) 2018-07-19 16:12:04 -07:00
misc.cpp Update include paths for ATen/core (#10130) 2018-08-03 11:57:02 -07:00
module.cpp Make torch::Tensor -> at::Tensor (#10516) 2018-08-15 21:25:12 -07:00
modules.cpp Make torch::Tensor -> at::Tensor (#10516) 2018-08-15 21:25:12 -07:00
optim_baseline.h Remove use of data() in optimizers (#10490) 2018-08-14 13:10:19 -07:00
optim_baseline.py Remove use of data() in optimizers (#10490) 2018-08-14 13:10:19 -07:00
optim.cpp Remove use of data() in optimizers (#10490) 2018-08-14 13:10:19 -07:00
parallel.cpp Make torch::Tensor -> at::Tensor (#10516) 2018-08-15 21:25:12 -07:00
README.md Update C++ API tests to use Catch2 (#7108) 2018-04-30 21:36:35 -04:00
rnn.cpp Use ATen implementation of RNNs (#10761) 2018-08-23 16:12:14 -07:00
sequential.cpp Make torch::Tensor -> at::Tensor (#10516) 2018-08-15 21:25:12 -07:00
serialization.cpp Refactor Device to not depend on Backend. (#10478) 2018-08-18 17:39:14 -07:00
static.cpp Make Sequential ref-counted (#9151) 2018-07-11 17:24:59 -07:00
tensor_cuda.cpp Functional DataParallel (#9234) 2018-07-19 16:12:04 -07:00
tensor_options_cuda.cpp Refactor Device to not depend on Backend. (#10478) 2018-08-18 17:39:14 -07:00
tensor_options.cpp Refactor Device to not depend on Backend. (#10478) 2018-08-18 17:39:14 -07:00
tensor.cpp Remove Tensor constructor of Scalar. (#10852) 2018-08-24 16:02:05 -07:00
util.h Make torch::Tensor -> at::Tensor (#10516) 2018-08-15 21:25:12 -07:00

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