Skip to content
Snippets Groups Projects
Commit fc658a13 authored by Cyril Moineau's avatar Cyril Moineau
Browse files

Fix assertion error when printing an empty Tensor.

parent f2127e1f
No related branches found
No related tags found
1 merge request!71Empty tensor print
......@@ -391,7 +391,7 @@ class Tensor : public Data,
std::string toString() const {
AIDGE_ASSERT(mImpl && mImpl->hostPtr() != nullptr, "tensor should have a valid host pointer");
AIDGE_ASSERT(mImpl && (dims().empty() || (dims() == std::vector<DimSize_t>({0})) || (mImpl->hostPtr() != nullptr)), "tensor should have a valid host pointer");
// TODO: move lambda elsewhere?
auto ptrToString = [](DataType dt, void* ptr, size_t idx) {
......@@ -471,7 +471,7 @@ class Tensor : public Data,
} else {
res += "{";
for (DimSize_t j = 0; j < dims()[0]; ++j) {
res += " " + ptrToString(mDataType, mImpl->hostPtr(), j) + ((j < dims()[0]-1) ? "," : "");
res += " " + ptrToString(mDataType, mImpl->hostPtr(), j) + ((j < dims()[0]-1) ? "," : " ");
}
}
res += "}";
......
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