Merge pull request #279 from ScheissSchiesser/fix_testDestroyTensorSingle
Fix TestDestroy.TestDestroyTensorSingle
This commit is contained in:
commit
8b08e7ccb5
1 changed files with 12 additions and 3 deletions
|
|
@ -27,17 +27,26 @@ TEST(TestDestroy, TestDestroyTensorSingle)
|
|||
{
|
||||
kp::Manager mgr;
|
||||
|
||||
tensorA = mgr.tensor({ 0, 0, 0 });
|
||||
const std::vector<float> initialValues = {0.0f, 0.0f, 0.0f};
|
||||
|
||||
tensorA = mgr.tensor(initialValues);
|
||||
|
||||
std::shared_ptr<kp::Algorithm> algo =
|
||||
mgr.algorithm({ tensorA }, spirv);
|
||||
mgr.algorithm({tensorA}, spirv);
|
||||
|
||||
// Sync values to and from device
|
||||
mgr.sequence()
|
||||
->eval<kp::OpTensorSyncDevice>(algo->getTensors());
|
||||
|
||||
EXPECT_EQ(tensorA->vector(), initialValues);
|
||||
|
||||
mgr.sequence()
|
||||
->record<kp::OpAlgoDispatch>(algo)
|
||||
->eval()
|
||||
->eval<kp::OpTensorSyncLocal>(algo->getTensors());
|
||||
|
||||
EXPECT_EQ(tensorA->vector(), std::vector<float>({ 1, 1, 1 }));
|
||||
const std::vector<float> expectedFinalValues = {1.0f, 1.0f, 1.0f};
|
||||
EXPECT_EQ(tensorA->vector(), expectedFinalValues);
|
||||
|
||||
tensorA->destroy();
|
||||
EXPECT_FALSE(tensorA->isInit());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue