Reformat
This commit is contained in:
parent
75315db943
commit
63e220a8a4
26 changed files with 667 additions and 624 deletions
|
|
@ -18,9 +18,9 @@ TEST(TestOpTensorCopy, CopyDeviceToDeviceTensor)
|
|||
EXPECT_TRUE(tensorB->isInit());
|
||||
|
||||
mgr.sequence()
|
||||
->eval<kp::OpTensorSyncDevice>({ tensorA, tensorB })
|
||||
->eval<kp::OpTensorCopy>({ tensorA, tensorB })
|
||||
->eval<kp::OpTensorSyncLocal>({ tensorA, tensorB });
|
||||
->eval<kp::OpTensorSyncDevice>({ tensorA, tensorB })
|
||||
->eval<kp::OpTensorCopy>({ tensorA, tensorB })
|
||||
->eval<kp::OpTensorSyncLocal>({ tensorA, tensorB });
|
||||
|
||||
// Making sure the GPU holds the same data
|
||||
EXPECT_EQ(tensorA->data(), tensorB->data());
|
||||
|
|
@ -44,15 +44,14 @@ TEST(TestOpTensorCopy, CopyDeviceToDeviceTensorMulti)
|
|||
EXPECT_TRUE(tensorC->isInit());
|
||||
|
||||
mgr.sequence()
|
||||
->eval<kp::OpTensorSyncLocal>({tensorA, tensorB, tensorC})
|
||||
->eval<kp::OpTensorCopy>({tensorA, tensorB, tensorC });
|
||||
->eval<kp::OpTensorSyncLocal>({ tensorA, tensorB, tensorC })
|
||||
->eval<kp::OpTensorCopy>({ tensorA, tensorB, tensorC });
|
||||
|
||||
EXPECT_EQ(tensorA->data(), tensorB->data());
|
||||
EXPECT_EQ(tensorA->data(), tensorC->data());
|
||||
|
||||
// Making sure the GPU holds the same data
|
||||
mgr.sequence()
|
||||
->eval<kp::OpTensorSyncLocal>({ tensorB, tensorC });
|
||||
mgr.sequence()->eval<kp::OpTensorSyncLocal>({ tensorB, tensorC });
|
||||
|
||||
EXPECT_EQ(tensorA->data(), tensorB->data());
|
||||
EXPECT_EQ(tensorA->data(), tensorC->data());
|
||||
|
|
@ -67,8 +66,8 @@ TEST(TestOpTensorCopy, CopyDeviceToHostTensor)
|
|||
std::vector<float> testVecB{ 0, 0, 0 };
|
||||
|
||||
std::shared_ptr<kp::Tensor> tensorA = mgr.tensor(testVecA);
|
||||
std::shared_ptr<kp::Tensor> tensorB = mgr.tensor(
|
||||
testVecB, kp::Tensor::TensorTypes::eHost);
|
||||
std::shared_ptr<kp::Tensor> tensorB =
|
||||
mgr.tensor(testVecB, kp::Tensor::TensorTypes::eHost);
|
||||
|
||||
// Only calling sync on device type tensor
|
||||
mgr.sequence()->eval<kp::OpTensorSyncDevice>({ tensorA });
|
||||
|
|
@ -93,8 +92,8 @@ TEST(TestOpTensorCopy, CopyHostToDeviceTensor)
|
|||
std::vector<float> testVecA{ 4, 5, 6 };
|
||||
std::vector<float> testVecB{ 0, 0, 0 };
|
||||
|
||||
std::shared_ptr<kp::Tensor> tensorA = mgr.tensor(
|
||||
testVecA, kp::Tensor::TensorTypes::eHost);
|
||||
std::shared_ptr<kp::Tensor> tensorA =
|
||||
mgr.tensor(testVecA, kp::Tensor::TensorTypes::eHost);
|
||||
std::shared_ptr<kp::Tensor> tensorB = mgr.tensor(testVecB);
|
||||
|
||||
// Only calling sync on device type tensor
|
||||
|
|
@ -120,17 +119,17 @@ TEST(TestOpTensorCopy, CopyHostToHostTensor)
|
|||
std::vector<float> testVecA{ 5, 6, 7 };
|
||||
std::vector<float> testVecB{ 0, 0, 0 };
|
||||
|
||||
std::shared_ptr<kp::Tensor> tensorA = mgr.tensor(
|
||||
testVecA, kp::Tensor::TensorTypes::eHost);
|
||||
std::shared_ptr<kp::Tensor> tensorB = mgr.tensor(
|
||||
testVecB, kp::Tensor::TensorTypes::eHost);
|
||||
std::shared_ptr<kp::Tensor> tensorA =
|
||||
mgr.tensor(testVecA, kp::Tensor::TensorTypes::eHost);
|
||||
std::shared_ptr<kp::Tensor> tensorB =
|
||||
mgr.tensor(testVecB, kp::Tensor::TensorTypes::eHost);
|
||||
|
||||
EXPECT_TRUE(tensorA->isInit());
|
||||
EXPECT_TRUE(tensorB->isInit());
|
||||
|
||||
mgr.sequence()
|
||||
->eval<kp::OpTensorSyncDevice>({ tensorA })
|
||||
->eval<kp::OpTensorCopy>({ tensorA, tensorB });
|
||||
->eval<kp::OpTensorSyncDevice>({ tensorA })
|
||||
->eval<kp::OpTensorCopy>({ tensorA, tensorB });
|
||||
|
||||
EXPECT_EQ(tensorA->data(), tensorB->data());
|
||||
|
||||
|
|
@ -146,8 +145,8 @@ TEST(TestOpTensorCopy, SingleTensorShouldFail)
|
|||
|
||||
std::vector<float> testVecA{ 6, 7, 8 };
|
||||
|
||||
std::shared_ptr<kp::Tensor> tensorA = mgr.tensor(
|
||||
testVecA, kp::Tensor::TensorTypes::eHost);
|
||||
std::shared_ptr<kp::Tensor> tensorA =
|
||||
mgr.tensor(testVecA, kp::Tensor::TensorTypes::eHost);
|
||||
|
||||
EXPECT_TRUE(tensorA->isInit());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue