Skip to content

Commit

Permalink
Add test for reserved tensor
Browse files Browse the repository at this point in the history
Reserved tensor now has a proper test, allocating 3 uint32_t.

Signed-off-by: Andrea Calabrese <[email protected]>
  • Loading branch information
ThePseudo committed Aug 6, 2024
1 parent 72bbb69 commit 10bbd41
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/include/kompute/Tensor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,7 @@ class TensorT : public Tensor
this->dataType(),
tensorType)
{
KP_LOG_DEBUG("Kompute TensorT constructor with data size {}",
data.size());
KP_LOG_DEBUG("Kompute TensorT constructor with data size {}", size);
}

TensorT(std::shared_ptr<vk::PhysicalDevice> physicalDevice,
Expand Down
8 changes: 8 additions & 0 deletions test/TestTensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ TEST(TestTensor, ConstructorData)
EXPECT_EQ(tensor->vector(), vec);
}

TEST(TestTensor, ReserveData)
{
kp::Manager mgr;
std::shared_ptr<kp::TensorT<float>> tensor = mgr.tensor(3, sizeof(uint32_t), Tensor::TensorDataType::eUnsignedInt);
EXPECT_EQ(tensor->size(), 0);
EXPECT_EQ(tensor->dataTypeMemorySize(), sizeof(uint32_t));
}

TEST(TestTensor, DataTypes)
{
kp::Manager mgr;
Expand Down

0 comments on commit 10bbd41

Please sign in to comment.