diff --git a/include/aidge/backend/cuda/data/TensorImpl.hpp b/include/aidge/backend/cuda/data/TensorImpl.hpp index 4f66a9321e46c11aa47e7d4b011b2d6a4f0e65a7..6b309c5e30585a71330de73568010ac72754aed7 100644 --- a/include/aidge/backend/cuda/data/TensorImpl.hpp +++ b/include/aidge/backend/cuda/data/TensorImpl.hpp @@ -81,6 +81,10 @@ public: } void copyCast(const void *src, NbElts_t length, const DataType srcDt) override { + if (length == 0) { + return; + } + if (srcDt == DataType::Float64) { thrust_copy(static_cast<const double*>(src), static_cast<T*>(rawPtr()), @@ -208,8 +212,6 @@ public: private: void lazyInit() { - AIDGE_INTERNAL_ASSERT(mTensor.dataType() == NativeType<T>::type); - if (mData.size() < mTensor.size()) { // Need more data, a re-allocation will occur AIDGE_ASSERT(mData.empty() || mDataOwner != nullptr, "trying to enlarge non-owned data");