You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/simple/README.md
+39-3Lines changed: 39 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,12 @@
2
2
3
3
This example simply performs a matrix multiplication, solely for the purpose of demonstrating a basic usage of ggml and backend handling. The code is commented to help understand what each part does.
4
4
5
+
Traditional matrix multiplication goes like this (multiply row-by-column):
6
+
7
+
$$
8
+
A \times B = C
9
+
$$
10
+
5
11
$$
6
12
\begin{bmatrix}
7
13
2 & 8 \\
@@ -16,9 +22,39 @@ $$
16
22
\end{bmatrix}
17
23
\=
18
24
\begin{bmatrix}
19
-
60 & 110 & 54 & 29 \\
20
-
55 & 90 & 126 & 28 \\
21
-
50 & 54 & 42 & 64 \\
25
+
60 & 90 & 42 \\
26
+
55 & 54 & 29 \\
27
+
50 & 54 & 28 \\
28
+
110 & 126 & 64 \\
29
+
\end{bmatrix}
30
+
$$
31
+
32
+
In `ggml`, we pass the matrix $B$ in transposed form and multiply row-by-row. The result $C$ is also transposed:
0 commit comments