diff --git a/include/aidge/backend/TensorImpl.hpp b/include/aidge/backend/TensorImpl.hpp index e11a6d26fd8d2977cbee39719ce32c8bf98cb057..57c6c385d5fdcc9f2439983bd04cc8ece0d8d8f5 100644 --- a/include/aidge/backend/TensorImpl.hpp +++ b/include/aidge/backend/TensorImpl.hpp @@ -201,9 +201,7 @@ public: /** * @brief Set every element of the implementation to zero. */ - virtual void zeros() { - AIDGE_THROW_OR_ABORT(std::runtime_error, "Function not implented"); - } + virtual void zeros() = 0; const std::string backend() const { return mBackend; } diff --git a/src/backend/cpu/data/TensorImpl.cpp b/src/backend/cpu/data/TensorImpl.cpp index 39ca71de9ea1bdb89f8138c3e38a016b516686dd..ed3c96f80c1b8bafd70425451d6618428d1888f0 100644 --- a/src/backend/cpu/data/TensorImpl.cpp +++ b/src/backend/cpu/data/TensorImpl.cpp @@ -38,12 +38,7 @@ bool Aidge::TensorImpl_cpu<T>::operator==(const Aidge::TensorImpl &other) const template <typename T> void Aidge::TensorImpl_cpu<T>::zeros() { - if (mData.empty()) { - lazyInit(); - } - for (std::size_t i = 0; i < mData.size(); ++i) { - *(mData.data() + i) = T(0); - } + std::memset(rawPtr(), T(0), mNbElts * sizeof(T)); } template <typename T>