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;