Initial base set of tests aligned with new interface
This commit is contained in:
parent
6378583a23
commit
fb617d1722
16 changed files with 908 additions and 1071 deletions
|
|
@ -5,36 +5,10 @@
|
|||
|
||||
TEST(TestTensor, ConstructorData)
|
||||
{
|
||||
std::vector<float> vec{ 0, 1, 2 };
|
||||
kp::Tensor tensor(vec);
|
||||
EXPECT_EQ(tensor.size(), vec.size());
|
||||
EXPECT_EQ(tensor.data(), vec);
|
||||
}
|
||||
|
||||
TEST(TestTensor, CopyFromHostData)
|
||||
{
|
||||
std::vector<float> vecA{ 0, 1, 2 };
|
||||
std::vector<float> vecB{ 0, 0, 0 };
|
||||
|
||||
std::shared_ptr<kp::Tensor> tensorA =
|
||||
std::make_shared<kp::Tensor>(vecA, kp::Tensor::TensorTypes::eHost);
|
||||
std::shared_ptr<kp::Tensor> tensorB =
|
||||
std::make_shared<kp::Tensor>(vecB, kp::Tensor::TensorTypes::eHost);
|
||||
|
||||
kp::Manager mgr;
|
||||
|
||||
mgr.rebuild({ tensorA, tensorB });
|
||||
|
||||
if (std::shared_ptr<kp::Sequence> sq =
|
||||
mgr.sequence("new")) {
|
||||
sq->begin();
|
||||
|
||||
sq->record<kp::OpTensorCopy>({ tensorA, tensorB });
|
||||
|
||||
sq->end();
|
||||
|
||||
sq->eval();
|
||||
}
|
||||
|
||||
EXPECT_EQ(tensorA->data(), tensorB->data());
|
||||
std::vector<float> vec{ 0, 1, 2 };
|
||||
std::shared_ptr<kp::Tensor> tensor = mgr.tensor(vec);
|
||||
EXPECT_EQ(tensor->size(), vec.size());
|
||||
EXPECT_EQ(tensor->data(), vec);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue