From 31bfd4a52bb369e3f47963d554742fa459f291be Mon Sep 17 00:00:00 2001 From: John <78893154+cmp-nct@users.noreply.github.com> Date: Tue, 23 Jan 2024 00:26:48 +0100 Subject: [PATCH] Update ggml.c changed sample precision to 7.4. Optimally this would be a parameter to pass to the function. 7.3 often shows just -0.000 or 0.000 on weights A higher precision would allow to see more in these type of small value tensors but it would also display less. --- ggml.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ggml.c b/ggml.c index 267e99c58..376d8fe98 100644 --- a/ggml.c +++ b/ggml.c @@ -20199,7 +20199,7 @@ void ggml_printTensorSample(const char *prefix, const struct ggml_tensor * tenso if (n_dims == 1) { printf("| 1: "); for(int i = 0; i < tensor->ne[0] && i < MAX_ELEMENTS_ROW; i++){ - printf("%-7.3f, ", *(double *)((char *) tensor_data + i*tensor->nb[0])); + printf("%-7.4f, ", *(double *)((char *) tensor_data + i*tensor->nb[0])); } if(MAX_ELEMENTS_ROW < tensor->ne[0]) printf(", .."); printf("\n%s", sep); @@ -20208,7 +20208,7 @@ void ggml_printTensorSample(const char *prefix, const struct ggml_tensor * tenso for(int i = 0; i < tensor->ne[0] && i < MAX_ELEMENTS_ROW; i++){ printf("| %d: ", i+1); for(int j = 0; j < tensor->ne[1] && j < MAX_ELEMENTS_COL; j++){ - printf("%-7.3f ", *(double *)((char *) tensor_data + i*tensor->nb[0] + j*tensor->nb[1])); + printf("%-7.4f ", *(double *)((char *) tensor_data + i*tensor->nb[0] + j*tensor->nb[1])); if(j == MAX_ELEMENTS_COL - 1 && tensor->ne[1] > MAX_ELEMENTS_COL) printf(", .."); } printf("\n"); @@ -20221,7 +20221,7 @@ void ggml_printTensorSample(const char *prefix, const struct ggml_tensor * tenso for(int j = 0; j < tensor->ne[1] && j < MAX_ELEMENTS_COL; j++){ printf("["); for(int k = 0; k < tensor->ne[2] && k < MAX_ELEMENTS_LAYER; k++){ - printf("%-7.3f", *(double *)((char *) tensor_data + i*tensor->nb[0] + j*tensor->nb[1] + k*tensor->nb[2])); + printf("%-7.4f", *(double *)((char *) tensor_data + i*tensor->nb[0] + j*tensor->nb[1] + k*tensor->nb[2])); if(k < tensor->ne[2] - 1 && k < MAX_ELEMENTS_LAYER - 1) printf(", "); } @@ -20240,7 +20240,7 @@ void ggml_printTensorSample(const char *prefix, const struct ggml_tensor * tenso for(int j = 0; j < tensor->ne[2] && j < MAX_ELEMENTS_COL; j++){ printf("["); for(int k = 0; k < tensor->ne[3] && k < MAX_ELEMENTS_LAYER; k++){ - printf("%-7.3f", *(double *)((char *) tensor_data + batch*tensor->nb[0] + i*tensor->nb[1] + j*tensor->nb[2] + k*tensor->nb[3])); + printf("%-7.4f", *(double *)((char *) tensor_data + batch*tensor->nb[0] + i*tensor->nb[1] + j*tensor->nb[2] + k*tensor->nb[3])); if(k < tensor->ne[3] - 1 && k < MAX_ELEMENTS_LAYER - 1) printf(", "); }