C++ API parity: TensorTest.Data fix

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/26920

Test Plan: Imported from OSS

Differential Revision: D17614135

Pulled By: pbelevich

fbshipit-source-id: 96d70a5e7724338d2829bf006696c2d0ac1025a6
This commit is contained in:
Pavel Belevich
2019-09-26 16:46:44 -07:00
committed by Facebook Github Bot
parent 388430f6bc
commit 77bfe61ff4
+2 -2
View File
@@ -390,10 +390,10 @@ TEST(TensorTest, DataPtr) {
}
TEST(TensorTest, Data) {
const auto tensor = torch::empty({3, 3});
const auto tensor = torch::rand({3, 3});
ASSERT_TRUE(torch::equal(tensor, tensor.data()));
const auto tensor2 = at::empty({3, 3});
const auto tensor2 = at::rand({3, 3});
ASSERT_THROW(tensor2.data(), c10::Error);
}