From aa2b8e0ca54b4cc1d5a5c68021f7cd1fad5933d2 Mon Sep 17 00:00:00 2001 From: stduhpf Date: Wed, 19 Nov 2025 16:27:23 +0100 Subject: [PATCH] fix: patch 1x1 conv weights at runtime (#986) --- ggml_extend.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ggml_extend.hpp b/ggml_extend.hpp index aa16645..c49ccf9 100644 --- a/ggml_extend.hpp +++ b/ggml_extend.hpp @@ -997,6 +997,9 @@ __STATIC_INLINE__ struct ggml_tensor* ggml_ext_conv_2d(struct ggml_context* ctx, if (scale != 1.f) { x = ggml_scale(ctx, x, scale); } + if (w->ne[2] != x->ne[2] && ggml_n_dims(w) == 2) { + w = ggml_reshape_4d(ctx, w, 1, 1, w->ne[0], w->ne[1]); + } if (direct) { x = ggml_conv_2d_direct(ctx, w, x, s0, s1, p0, p1, d0, d1); } else {