From 945f10a26b58fabb6e9f2a67c22cabffdaee5a80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20du=20Hamel?= Date: Mon, 17 Nov 2025 19:08:21 +0100 Subject: [PATCH] fix: patch 1x1 conv weights at runtime --- ggml_extend.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ggml_extend.hpp b/ggml_extend.hpp index aa1664589..c49ccf93e 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 {