Skip to content
Snippets Groups Projects
Commit e44d7267 authored by Christophe Guillon's avatar Christophe Guillon Committed by Maxence Naud
Browse files

[Tensor] Minor change of assertions in getStorageIdx()

parent 12c3e45c
No related branches found
No related tags found
No related merge requests found
...@@ -665,10 +665,10 @@ public: ...@@ -665,10 +665,10 @@ public:
* @return DimSize_t Storage index * @return DimSize_t Storage index
*/ */
std::size_t getStorageIdx(const std::vector<std::size_t>& coordIdx) const { std::size_t getStorageIdx(const std::vector<std::size_t>& coordIdx) const {
AIDGE_ASSERT(coordIdx.size() <= mDims.size(), "Coordinates does not match number of dimensions");
for(std::size_t i = 0; i < coordIdx.size(); ++i) { for(std::size_t i = 0; i < coordIdx.size(); ++i) {
AIDGE_ASSERT(coordIdx[i] < mDims[i], "Coordinates dimensions does not fit the dimensions of the tensor"); AIDGE_ASSERT(coordIdx[i] < mDims[i], "Coordinates dimensions does not fit the dimensions of the tensor");
} }
AIDGE_ASSERT(coordIdx.size() <= mDims.size(), "Coordinates does not match number of dimensions");
return std::inner_product(coordIdx.cbegin(), coordIdx.cend(), mStrides.cbegin(), DimSize_t(0)); return std::inner_product(coordIdx.cbegin(), coordIdx.cend(), mStrides.cbegin(), DimSize_t(0));
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment