ggml icon indicating copy to clipboard operation
ggml copied to clipboard

Asserting over nb[0] as type check causes issue for tensors after permuting

Open cndn opened this issue 1 year ago • 1 comments

Is the intention of asserts like https://github.com/ggerganov/ggml/blob/master/src/ggml.c#L8772 to type check? I have a fp32 tensor as a result of permutation function, so nb[0] is no longer sizeof(float) and triggers the issue here.

Replacing with "GGML_ASSERT(src1->type == GGML_TYPE_F32);" works perfectly, but just checking if there are other purposes for this check. Thanks!

cndn avatar Sep 19 '23 21:09 cndn

This function seems to assume that the src0 is contigous, so you can do ggml_cont(..) on the first argument of the add you do.

YavorGIvanov avatar Sep 20 '23 08:09 YavorGIvanov