]> git.djapps.eu Git - pkg/ggml/sources/ggml/commitdiff
fix a bug in examples/simple/simple-backend (#1078)
authorShawn yang <redacted>
Fri, 7 Feb 2025 17:10:21 +0000 (01:10 +0800)
committerGitHub <redacted>
Fri, 7 Feb 2025 17:10:21 +0000 (11:10 -0600)
Co-authored-by: yangxiao <redacted>
examples/simple/simple-backend.cpp

index d9c72cdf17105f06bdd66133ae7263d1f1718209..5ec3e5f7203f698ed2f4d3d826111a15ee162b18 100644 (file)
@@ -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");