Skip to content

Commit bf4b484

Browse files
committed
Update blog
1 parent b34d75f commit bf4b484

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

content/blog/2025-11-07-1762514507.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,23 @@ Wrote a simple script to convert ONNX to GGML. It auto-generates C++ code that c
1515

1616
The generated file can work on multiple backends: CPU, CUDA, ROCm, Vulkan, Metal etc, by providing the correct compiler flags during `cmake -B`, e.g. `-D GGML_CUDA=1` for CUDA.
1717

18+
The original PyTorch model was:
19+
20+
```py
21+
class TinyCNN(nn.Module):
22+
def __init__(self):
23+
super().__init__()
24+
self.conv = nn.Conv2d(3, 8, 3, stride=1, padding=1)
25+
self.relu = nn.ReLU()
26+
self.pool = nn.AdaptiveAvgPool2d((1, 1))
27+
self.fc = nn.Linear(8, 4) # 4-class toy output
28+
29+
def forward(self, x):
30+
x = self.relu(self.conv(x))
31+
x = self.pool(x).flatten(1)
32+
return self.fc(x)
33+
```
34+
1835
Repo: [https://github.com/cmdr2/graph-compiler](https://github.com/cmdr2/graph-compiler)
1936

2037
I've currently got it to work for a TinyCNN model, and will add more operators as I make it convert larger models.

0 commit comments

Comments
 (0)