From: Georgi Gerganov Date: Wed, 7 Jun 2023 16:14:50 +0000 (+0300) Subject: ggml : fix ggml_clamp thresholds being read as ints instead of floats (#221) X-Git-Tag: upstream/0.0.1642~1416 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=9af0d1189a0bf5bb180abc2fbd95b97f212ae325;p=pkg%2Fggml%2Fsources%2Fggml ggml : fix ggml_clamp thresholds being read as ints instead of floats (#221) --- diff --git a/src/ggml.c b/src/ggml.c index 18a2007b..f4150161 100644 --- a/src/ggml.c +++ b/src/ggml.c @@ -6383,7 +6383,7 @@ struct ggml_tensor * ggml_clamp( ggml_scratch_save(ctx); - struct ggml_tensor * b = ggml_new_tensor_1d(ctx, GGML_TYPE_I32, 3); + struct ggml_tensor * b = ggml_new_tensor_1d(ctx, GGML_TYPE_F32, 3); ((float *) b->data)[0] = min; ((float *) b->data)[1] = max; @@ -11139,8 +11139,8 @@ static void ggml_compute_forward_clamp_f32( return; } - const int min = ((float *) src1->data)[0]; - const int max = ((float *) src1->data)[1]; + const float min = ((float *) src1->data)[0]; + const float max = ((float *) src1->data)[1]; const int ith = params->ith; const int nth = params->nth;