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
2 merge requests!212Version 0.3.0,!171[Tensor] Fix invalid getIdx() method
Pipeline #51253 passed
......@@ -665,10 +665,10 @@ public:
* @return DimSize_t Storage index
*/
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) {
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));
}
......
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