From a252111b45d5b5080ab6d578ae81a3d8bbc5c1bc Mon Sep 17 00:00:00 2001 From: xaedes Date: Fri, 18 Aug 2023 15:03:57 +0200 Subject: [PATCH] fix bug in ggml_out_prod which resulted in wrong n_dims of result tensors --- ggml.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ggml.c b/ggml.c index f9f523f36..c1fc3a7f2 100644 --- a/ggml.c +++ b/ggml.c @@ -5928,7 +5928,7 @@ struct ggml_tensor * ggml_out_prod( } const int64_t ne[4] = { a->ne[0], b->ne[0], a->ne[2], b->ne[3] }; - struct ggml_tensor * result = ggml_new_tensor(ctx, GGML_TYPE_F32, MIN(a->n_dims, b->n_dims), ne); + struct ggml_tensor * result = ggml_new_tensor(ctx, GGML_TYPE_F32, MAX(a->n_dims, b->n_dims), ne); result->op = GGML_OP_OUT_PROD; result->grad = is_node ? ggml_dup_tensor(ctx, result) : NULL;