pytorch/test/cpp/lazy/test_tensor_impl.cpp
Will Constable 3547f20872 Land remaining parts of Torchscript Lazy Tensor backend (#74111)
Summary:
Also enables bazel build to run lazy codegen.  Bazel (oss) build feeds off the same filelists as cmake/buck (build_variables.bzl), so enabling it is easier than keeping it disabled.

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

Test Plan: Run CI and verify test_lazy_ops is running via OSS cmake builds

Reviewed By: bdhirsh

Differential Revision: D34772403

fbshipit-source-id: 8a63f58b9536e6ac1be530667932176ef2549496
(cherry picked from commit e807ffb1918853d10b924fdc24f85ee5b1a39021)
2022-03-22 23:14:03 +00:00

20 lines
498 B
C++

#include <gtest/gtest.h>
#include <torch/csrc/lazy/core/tensor_impl.h>
#include <torch/torch.h>
namespace torch {
namespace lazy {
#ifdef FBCODE_CAFFE2
// Lazy Tensor is disabled in FBCODE until addressing non-virtual methods (e.g. sizes) in TensorImpl
TEST(LazyTensorImplTest, BasicThrow) {
EXPECT_THROW({
auto input = torch::rand({0, 1, 3, 0}, torch::TensorOptions(torch::kFloat).device("lazy"));
}, ::c10::Error);
}
#endif // FBCODE_CAFFE2
} // namespace lazy
} // namespace torch