pytorch/test
Peter Goldsborough 148088a681 Convert at::Tensor to torch::Tensor in AnyModule (#8968)
Summary:
Operations on `Variable`s (or `torch::Tensor`) usually return `at::Tensor`. This is usually fine, but the `AnyModule` used in the implementation of `torch::Sequential` is very picky about types, and does not understand implicit conversions like this. This means that `sequential.forward(at_tensor_that_is_actually_a_variable)` will fail unless you wrap `at_tensor_that_is_actually_a_variable` with `torch::Tensor`.

This PR adds a special case to `AnyModule` that will convert an `at::Tensor` to `torch::Tensor` when the tensor is really a variable, and else just pass the `at::Tensor`. This is a nice little usability improvement for the often-used `Sequential` class.

ebetica ezyang
Closes https://github.com/pytorch/pytorch/pull/8968

Reviewed By: ezyang

Differential Revision: D8670407

Pulled By: goldsborough

fbshipit-source-id: 3635ed6ed28238f3900ce4a876d07f1b11713831
2018-06-28 06:40:48 -07:00
..
bottleneck
cpp/api Convert at::Tensor to torch::Tensor in AnyModule (#8968) 2018-06-28 06:40:48 -07:00
cpp_extensions Add file and line to CUDA_CHECK and CUDNN_CHECK (#8836) 2018-06-25 10:46:52 -04:00
data
error_messages
expect [build] Use conda cmake in two CI builds (#8864) 2018-06-26 17:22:04 -04:00
ffi/src
onnx Create ATen tensors via TensorOptions (#7869) 2018-06-16 00:40:35 -07:00
optim
common.py Build system changes (#8627) 2018-06-20 17:45:26 -04:00
common_cuda.py Add memory leak check in CUDA tests (#7270) 2018-05-31 15:09:54 -04:00
common_nn.py Add memory leak check in CUDA tests (#7270) 2018-05-31 15:09:54 -04:00
run_test.py Create initial Python bindings for c10d (#8119) 2018-06-08 12:59:51 -07:00
test_autograd.py Add AT_WARN to issue warnings from ATen (#8967) 2018-06-27 21:24:39 -07:00
test_c10d.py Export ProcessGroupGloo options to Python (#8664) 2018-06-20 09:08:06 -07:00
test_cpp_extensions.py Export tensor descriptor (#8313) 2018-06-20 22:32:50 -07:00
test_cuda.py Test that broadcast doesn't copy when dst and src devices are the same (#8803) 2018-06-22 17:36:19 -04:00
test_dataloader.py [READY TO MERGE] Enable tests that use DataLoader with multiple workers on Windows (#6745) 2018-06-06 22:50:39 -04:00
test_distributed.py Build system changes (#8627) 2018-06-20 17:45:26 -04:00
test_distributed_trap.py fbshipit-source-id: ba600fcd2b5cefc7621357bdeb05e24cea02e5af 2018-06-27 04:50:56 -07:00
test_distributions.py Add half cauchy, half normal distributions (#8411) 2018-06-14 10:28:42 +02:00
test_indexing.py torch.arange: add numpy-style type inference. (#7016) 2018-04-27 15:11:45 -04:00
test_jit.py Allow autograd to work even when the shape of values cannot be determined (#8641) 2018-06-25 18:40:04 -07:00
test_legacy_nn.py Migrated hardshrink() to ATen and deprecated nn.Hardshrink() (#8117) 2018-06-14 16:42:20 -04:00
test_multiprocessing.py torch.arange: add numpy-style type inference. (#7016) 2018-04-27 15:11:45 -04:00
test_nccl.py Add memory leak check in CUDA tests (#7270) 2018-05-31 15:09:54 -04:00
test_nn.py Check key should be string in nn.Module.add_module, parameter and buffer (#8960) 2018-06-27 19:40:00 -07:00
test_optim.py Make return uniform in lbfgs step (#7586) 2018-05-16 11:16:46 -04:00
test_sparse.py Create ATen tensors via TensorOptions (#7869) 2018-06-16 00:40:35 -07:00
test_torch.py Update from Facebook (#8887) 2018-06-26 14:55:48 -07:00
test_utils.py [build] Use conda cmake in two CI builds (#8864) 2018-06-26 17:22:04 -04:00