From 10bbd410c72237ea983aee679949947697245f60 Mon Sep 17 00:00:00 2001 From: Andrea Calabrese Date: Mon, 29 Jul 2024 08:24:58 +0200 Subject: [PATCH] Add test for reserved tensor Reserved tensor now has a proper test, allocating 3 uint32_t. Signed-off-by: Andrea Calabrese --- src/include/kompute/Tensor.hpp | 3 +-- test/TestTensor.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/include/kompute/Tensor.hpp b/src/include/kompute/Tensor.hpp index 234f97cb..715fe19f 100644 --- a/src/include/kompute/Tensor.hpp +++ b/src/include/kompute/Tensor.hpp @@ -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 physicalDevice, diff --git a/test/TestTensor.cpp b/test/TestTensor.cpp index 7eeff4af..0aaeb995 100644 --- a/test/TestTensor.cpp +++ b/test/TestTensor.cpp @@ -15,6 +15,14 @@ TEST(TestTensor, ConstructorData) EXPECT_EQ(tensor->vector(), vec); } +TEST(TestTensor, ReserveData) +{ + kp::Manager mgr; + std::shared_ptr> 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;