pytorch/test/cpp/lazy/test_tensor_impl.cpp
Jiewen Tan e02d836cb2 [LTC] Upstream LTCTensorImpl (#70062)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/70062

This commit upstreams LTCTensorImpl from the lazy_tensor_staging branch.
It inherits from c10::TensorImpl and thus manages the lifetime/storage
of LazyTensor.

Test Plan: ./build/bin/test_lazy --gtest_filter=LazyTensorImplTest.*

Reviewed By: desertfire

Differential Revision: D33171186

Pulled By: alanwaketan

fbshipit-source-id: 6af9f91cc7c7e997f120cb89a7bcd6785c03ace0
2021-12-22 03:21:52 -08:00

18 lines
446 B
C++

#include <gtest/gtest.h>
#include <torch/csrc/lazy/core/tensor_impl.h>
#include <torch/torch.h>
namespace torch {
namespace lazy {
// TODO(alanwaketan): Update the following unit tests once the TorchScript backend is merged.
TEST(LazyTensorImplTest, BasicThrow) {
EXPECT_THROW({
auto input = torch::rand({0, 1, 3, 0}, torch::TensorOptions(torch::kFloat).device("lazy"));
}, ::c10::Error);
}
} // namespace lazy
} // namespace torch