Working implementation with tests

This commit is contained in:
Alejandro Saucedo 2021-03-07 08:00:19 +00:00
parent cf7d46cd23
commit f02b9d6915
21 changed files with 297 additions and 216 deletions

View file

@ -11,7 +11,7 @@ TEST(TestOpTensorSync, SyncToDeviceMemorySingleTensor)
std::vector<float> testVecPreA{ 0, 0, 0 };
std::vector<float> testVecPostA{ 9, 8, 7 };
std::shared_ptr<kp::Tensor> tensorA = mgr.tensor(testVecPreA);
std::shared_ptr<kp::TensorT<float>> tensorA = mgr.tensor(testVecPreA);
EXPECT_TRUE(tensorA->isInit());
@ -21,7 +21,7 @@ TEST(TestOpTensorSync, SyncToDeviceMemorySingleTensor)
mgr.sequence()->eval<kp::OpTensorSyncLocal>({ tensorA });
EXPECT_EQ(tensorA->data(), testVecPostA);
EXPECT_EQ(tensorA->vector(), testVecPostA);
}
TEST(TestOpTensorSync, SyncToDeviceMemoryMultiTensor)
@ -31,9 +31,9 @@ TEST(TestOpTensorSync, SyncToDeviceMemoryMultiTensor)
std::vector<float> testVec{ 9, 8, 7 };
std::shared_ptr<kp::Tensor> tensorA = mgr.tensor({ 0, 0, 0 });
std::shared_ptr<kp::Tensor> tensorB = mgr.tensor({ 0, 0, 0 });
std::shared_ptr<kp::Tensor> tensorC = mgr.tensor({ 0, 0, 0 });
std::shared_ptr<kp::TensorT<float>> tensorA = mgr.tensor({ 0, 0, 0 });
std::shared_ptr<kp::TensorT<float>> tensorB = mgr.tensor({ 0, 0, 0 });
std::shared_ptr<kp::TensorT<float>> tensorC = mgr.tensor({ 0, 0, 0 });
EXPECT_TRUE(tensorA->isInit());
EXPECT_TRUE(tensorB->isInit());
@ -47,7 +47,7 @@ TEST(TestOpTensorSync, SyncToDeviceMemoryMultiTensor)
mgr.sequence()->eval<kp::OpTensorSyncLocal>({ tensorA, tensorB, tensorC });
EXPECT_EQ(tensorA->data(), testVec);
EXPECT_EQ(tensorB->data(), testVec);
EXPECT_EQ(tensorC->data(), testVec);
EXPECT_EQ(tensorA->vector(), testVec);
EXPECT_EQ(tensorB->vector(), testVec);
EXPECT_EQ(tensorC->vector(), testVec);
}