@@ -45,6 +45,8 @@ static float common_ggml_get_float_value(const uint8_t * data,
4545 return v;
4646}
4747
48+ #define INDENT " "
49+
4850template <bool abort>
4951void common_debug_print_tensor (uint8_t * data, ggml_type type, const int64_t * ne, const size_t * nb, int64_t n) {
5052 GGML_ASSERT (n > 0 );
@@ -60,41 +62,41 @@ void common_debug_print_tensor(uint8_t * data, ggml_type type, const int64_t * n
6062 }
6163 }
6264 for (int64_t i3 = 0 ; i3 < ne[3 ]; i3++) {
63- LOG_ERR ( " [\n " );
65+ LOG ( INDENT " [\n " );
6466 for (int64_t i2 = 0 ; i2 < ne[2 ]; i2++) {
6567 if (i2 == n && ne[2 ] > 2 * n) {
66- LOG_ERR ( " ..., \n " );
68+ LOG ( INDENT INDENT " ..., \n " );
6769 i2 = ne[2 ] - n;
6870 }
69- LOG_ERR ( " [\n " );
71+ LOG ( INDENT INDENT " [\n " );
7072 for (int64_t i1 = 0 ; i1 < ne[1 ]; i1++) {
7173 if (i1 == n && ne[1 ] > 2 * n) {
72- LOG_ERR ( " ..., \n " );
74+ LOG ( INDENT INDENT INDENT " ..., \n " );
7375 i1 = ne[1 ] - n;
7476 }
75- LOG_ERR ( " [" );
77+ LOG ( INDENT INDENT INDENT " [" );
7678 for (int64_t i0 = 0 ; i0 < ne[0 ]; i0++) {
7779 if (i0 == n && ne[0 ] > 2 * n) {
78- LOG_ERR ( " ..., " );
80+ LOG ( " ..., " );
7981 i0 = ne[0 ] - n;
8082 }
8183 const float v = common_ggml_get_float_value (data, type, nb, i0, i1, i2, i3);
82- LOG_ERR (" %12.4f" , v);
84+ LOG (" %12.4f" , v);
8385 if (i0 < ne[0 ] - 1 ) {
84- LOG_ERR (" , " );
86+ LOG (" , " );
8587 }
8688 }
87- LOG_ERR ( " ],\n " );
89+ LOG ( " ],\n " );
8890 }
89- LOG_ERR ( " ],\n " );
91+ LOG ( INDENT INDENT " ],\n " );
9092 }
91- LOG_ERR ( " ]\n " );
92- LOG_ERR ( " sum = %f\n " , sum);
93+ LOG ( INDENT " ]\n " );
94+ LOG ( INDENT " sum = %f\n " , sum);
9395 }
9496
9597 if constexpr (abort) {
9698 if (std::isnan (sum)) {
97- LOG_ERR (" encountered NaN - aborting\n " );
99+ LOG (" encountered NaN - aborting\n " );
98100 exit (0 );
99101 }
100102 }
@@ -137,9 +139,9 @@ template <bool abort_on_nan> bool common_debug_cb_eval(struct ggml_tensor * t, b
137139 }
138140
139141 if (matches_filter) {
140- LOG_ERR (" %s: %24s = (%s) %10s(%s{%s}, %s}) = {%s}\n " , __func__, t->name , ggml_type_name (t->type ),
141- ggml_op_desc (t), src0->name , common_ggml_ne_string (src0).c_str (), src1 ? src1_str : " " ,
142- common_ggml_ne_string (t).c_str ());
142+ LOG (" %s: %24s = (%s) %10s(%s{%s}, %s}) = {%s}\n " , __func__, t->name , ggml_type_name (t->type ),
143+ ggml_op_desc (t), src0->name , common_ggml_ne_string (src0).c_str (), src1 ? src1_str : " " ,
144+ common_ggml_ne_string (t).c_str ());
143145 }
144146
145147 const bool is_host = ggml_backend_buffer_is_host (t->buffer );
0 commit comments