Skip to content

Fix/issue 1433#1434

Merged
ggerganov merged 3 commits intoggml-org:masterfrom
David366AI:fix/issue-1433
Mar 15, 2026
Merged

Fix/issue 1433#1434
ggerganov merged 3 commits intoggml-org:masterfrom
David366AI:fix/issue-1433

Conversation

@David366AI
Copy link
Contributor

Fix bug #1433

In file ops.cpp

// ggml_compute_forward_im2col_f16
// src0: kernel [OC, IC, KH, KW]
// src1: image [N, IC, IH, IW]
// dst: result [N, OH, OW, ICKHKW]
static void ggml_compute_forward_im2col_f16(
const ggml_compute_params * params,
ggml_tensor * dst) {

const ggml_tensor * src0 = dst->src[0];
const ggml_tensor * src1 = dst->src[1];

GGML_ASSERT(src0->type == GGML_TYPE_F16);
GGML_ASSERT(src1->type == GGML_TYPE_F32); // This line is not so reasonable.
GGML_ASSERT( dst->type == GGML_TYPE_F16);
The follow picture is from one onnx (yolo26 export half onnx).
dst is F16, src0 (Kernel) is F16, image is F16, but
GGML_ASSERT(src1->type == GGML_TYPE_F32); // Assert failed.
It doesn't make sense.

Suggest to change to be:
GGML_ASSERT(src1->type == GGML_TYPE_F32 || src1->type == GGML_TYPE_F16);

@David366AI
Copy link
Contributor Author

The solution only fix CPU backend.

If you approve it, I could fix cuda/vulkan/Metal etc.

@ggerganov
Copy link
Member

@David366AI Thank you for the contributions. Waiting for the CI to pass and will merge.

@ggerganov ggerganov merged commit 9d0addf into ggml-org:master Mar 15, 2026
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants