From 49f09aa72c0338817f3c50271b8e420a4bf66251 Mon Sep 17 00:00:00 2001 From: zhangjidong <1119708529@qq.com> Date: Tue, 30 Jan 2024 20:36:08 +0800 Subject: [PATCH] fix avg pooling, count_include_pad nits --- ggml-cuda.cu | 2 +- ggml.c | 4 ++-- ggml.h | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ggml-cuda.cu b/ggml-cuda.cu index 20e3b5efa..5980e29bd 100644 --- a/ggml-cuda.cu +++ b/ggml-cuda.cu @@ -6056,7 +6056,7 @@ static __global__ void pool2d_nchw_kernel( const int start_w = cur_ow * sw - pw; const int bw = max(0, start_w); const int ew = min(iw, start_w + kw); - const To scale = 1. / ((eh - bh) * (ew - bw)); + const To scale = 1. / (kh * kw); To res = 0; switch(op){ case GGML_OP_POOL_AVG: res = 0; break; diff --git a/ggml.c b/ggml.c index ccb1bfb5e..ad0a503fd 100644 --- a/ggml.c +++ b/ggml.c @@ -5569,8 +5569,8 @@ struct ggml_tensor * ggml_pool_2d( int k1, int s0, int s1, - float p0, - float p1) { + int p0, + int p1) { bool is_node = false; diff --git a/ggml.h b/ggml.h index cf568b3e5..5a56f73b7 100644 --- a/ggml.h +++ b/ggml.h @@ -1600,8 +1600,8 @@ extern "C" { int k1, int s0, int s1, - float p0, - float p1); + int p0, + int p1); // nearest interpolate // used in stable-diffusion