From: Shawn yang Date: Fri, 7 Feb 2025 17:10:21 +0000 (+0800) Subject: fix a bug in examples/simple/simple-backend (#1078) X-Git-Tag: upstream/0.0.1722~30 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=d633684e9bae012b68045936320c14e1466d693f;p=pkg%2Fggml%2Fsources%2Fggml fix a bug in examples/simple/simple-backend (#1078) Co-authored-by: yangxiao --- diff --git a/examples/simple/simple-backend.cpp b/examples/simple/simple-backend.cpp index d9c72cdf..5ec3e5f7 100644 --- a/examples/simple/simple-backend.cpp +++ b/examples/simple/simple-backend.cpp @@ -190,9 +190,9 @@ int main(void) { ggml_backend_tensor_get(result, out_data.data(), 0, ggml_nbytes(result)); // expected result: - // [ 60.00 110.00 54.00 29.00 - // 55.00 90.00 126.00 28.00 - // 50.00 54.00 42.00 64.00 ] + // [ 60.00 55.00 50.00 110.00 + // 90.00 54.00 54.00 126.00 + // 42.00 29.00 28.00 64.00 ] printf("mul mat (%d x %d) (transposed result):\n[", (int) result->ne[0], (int) result->ne[1]); for (int j = 0; j < result->ne[1] /* rows */; j++) { @@ -201,7 +201,7 @@ int main(void) { } for (int i = 0; i < result->ne[0] /* cols */; i++) { - printf(" %.2f", out_data[i * result->ne[1] + j]); + printf(" %.2f", out_data[j * result->ne[0] + i]); } } printf(" ]\n");