mirror of
https://github.com/pytorch/pytorch.git
synced 2026-11-20 09:04:25 +08:00
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:
committed by
Facebook Github Bot
parent
388430f6bc
commit
77bfe61ff4
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user