From 491d2dc133c17793f71f50e4071b1861b4c65e08 Mon Sep 17 00:00:00 2001 From: thibault allenet <thibault.allenet@cea.fr> Date: Mon, 12 Feb 2024 14:31:32 +0000 Subject: [PATCH] Update TensorImpl constructor to take the tensor dimensions instead of the number of elements. --- include/aidge/backend/cpu/data/TensorImpl.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/aidge/backend/cpu/data/TensorImpl.hpp b/include/aidge/backend/cpu/data/TensorImpl.hpp index d8a11f14..c9a0e6d2 100644 --- a/include/aidge/backend/cpu/data/TensorImpl.hpp +++ b/include/aidge/backend/cpu/data/TensorImpl.hpp @@ -33,7 +33,7 @@ private: public: static constexpr const char *Backend = "cpu"; - TensorImpl_cpu(DeviceIdx_t device, NbElts_t length) : TensorImpl(Backend, device, length) {} + TensorImpl_cpu(DeviceIdx_t device, std::vector<DimSize_t> dims) : TensorImpl(Backend, device, dims) {} bool operator==(const TensorImpl &otherImpl) const override final { const auto& typedOtherImpl = reinterpret_cast<const TensorImpl_cpu<T> &>(otherImpl); @@ -47,8 +47,8 @@ public: return i == mNbElts; } - static std::shared_ptr<TensorImpl_cpu> create(DeviceIdx_t device, NbElts_t length) { - return std::make_shared<TensorImpl_cpu<T>>(device, length); + static std::shared_ptr<TensorImpl_cpu> create(DeviceIdx_t device, std::vector<DimSize_t> dims) { + return std::make_shared<TensorImpl_cpu<T>>(device, dims); } inline std::size_t scalarSize() const noexcept override final { return sizeof(T); } -- GitLab