Skip to content
Snippets Groups Projects

Empty tensor print

Merged Cyril Moineau requested to merge EmptyTensorPrint into main
2 files
+ 12
8
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -391,7 +391,7 @@ class Tensor : public Data,
@@ -391,7 +391,7 @@ class Tensor : public Data,
std::string toString() const {
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?
// TODO: move lambda elsewhere?
auto ptrToString = [](DataType dt, void* ptr, size_t idx) {
auto ptrToString = [](DataType dt, void* ptr, size_t idx) {
@@ -471,7 +471,7 @@ class Tensor : public Data,
@@ -471,7 +471,7 @@ class Tensor : public Data,
} else {
} else {
res += "{";
res += "{";
for (DimSize_t j = 0; j < dims()[0]; ++j) {
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 += "}";
res += "}";
Loading