fix bug in ggml_out_prod which resulted in wrong n_dims of result tensors

This commit is contained in:
xaedes 2023-08-18 15:03:57 +02:00
parent 44526cb261
commit a252111b45
No known key found for this signature in database
GPG key ID: 30030EDD817EA2B1

2
ggml.c
View file

@ -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] }; 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->op = GGML_OP_OUT_PROD;
result->grad = is_node ? ggml_dup_tensor(ctx, result) : NULL; result->grad = is_node ? ggml_dup_tensor(ctx, result) : NULL;