diff --git a/ggml/src/ggml-et/ggml-et.cpp b/ggml/src/ggml-et/ggml-et.cpp index 61c31d6f29..755077fad5 100644 --- a/ggml/src/ggml-et/ggml-et.cpp +++ b/ggml/src/ggml-et/ggml-et.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #if __has_include() @@ -32,9 +33,7 @@ namespace fs = std::experimental::filesystem; * @brief prints the metadata of a single tensorf */ static void ggml_et_dump_tensor_metadata(const ggml_tensor * ggtensor, size_t indent_level, const char * title) { - char * spaces = (char *) alloca(indent_level + 1); - memset(spaces, ' ', indent_level); - spaces[indent_level] = '\0'; + std::string spaces(indent_level, ' '); fprintf(stderr, "%s%s: %s\n" "%s type: %s\n" @@ -43,10 +42,10 @@ static void ggml_et_dump_tensor_metadata(const ggml_tensor * ggtensor, size_t in "%s op: %s\n" "%s data: %p\n" "%s src0: %p\n", - spaces, title, ggtensor->name, spaces, ggml_type_name(ggtensor->type), spaces, (long long) ggtensor->ne[0], - (long long) ggtensor->ne[1], (long long) ggtensor->ne[2], (long long) ggtensor->ne[3], spaces, - ggtensor->nb[0], ggtensor->nb[1], ggtensor->nb[2], ggtensor->nb[3], spaces, ggml_op_name(ggtensor->op), - spaces, ggtensor->data, spaces, (void *) ggtensor->src[0]); + spaces.c_str(), title, ggtensor->name, spaces.c_str(), ggml_type_name(ggtensor->type), spaces.c_str(), (long long) ggtensor->ne[0], + (long long) ggtensor->ne[1], (long long) ggtensor->ne[2], (long long) ggtensor->ne[3], spaces.c_str(), + ggtensor->nb[0], ggtensor->nb[1], ggtensor->nb[2], ggtensor->nb[3], spaces.c_str(), ggml_op_name(ggtensor->op), + spaces.c_str(), ggtensor->data, spaces.c_str(), (void *) ggtensor->src[0]); } /*