From 5ace21a4fd40554ccb89d4c4e7907545f3ee9e3d Mon Sep 17 00:00:00 2001 From: NAUD Maxence <maxence.naud@cea.fr> Date: Mon, 25 Mar 2024 13:54:06 +0000 Subject: [PATCH] Add member function 'Tensor::backend' to check the backend in Tensor --- include/aidge/data/Tensor.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/aidge/data/Tensor.hpp b/include/aidge/data/Tensor.hpp index a5d59e389..2503c01b3 100644 --- a/include/aidge/data/Tensor.hpp +++ b/include/aidge/data/Tensor.hpp @@ -348,6 +348,10 @@ public: return newTensor; } + const std::string backend() const { + return hasImpl() ? getImpl()->backend() : ""; + } + /** * @brief Set the backend of the Tensor associated implementation. If there * was no previous implementation set, data will be allocated, but it will @@ -410,8 +414,8 @@ public: * @brief Get the Impl object * @return constexpr const std::shared_ptr<TensorImpl>& */ - constexpr const std::shared_ptr<TensorImpl> &getImpl() const { return mImpl; } - constexpr std::size_t getImplOffset() const { return mImplOffset; } + constexpr const std::shared_ptr<TensorImpl>& getImpl() const noexcept { return mImpl; } + constexpr std::size_t getImplOffset() const noexcept { return mImplOffset; } /** * @brief Set the Impl object -- GitLab