U-Net by hand ✍️ ~ 17 steps walkthrough below
I consider U-Net as a key milestone in deep learning, the first image-to-image model that really worked!
It came out of medical imaging, an unusual place, not from NeurIPS or CVPR or ACL.
Now it is the backbone of diffusion models, which you see in almost all modern image generation models.
I drew the network as a C so the matrix multiplication flows naturally down.
Tilt your head to the right and it is a U again. 🤣
Goal: push a 3 x 16 image down to a 2 x 4 bottleneck and back out again, filling in every cell yourself.
= 1. Given =
An image of three channels, R, G and B, sixteen pixels wide, and every kernel the network will use.
= 2. Convolution 1 =
Let us slide the first kernel over the image. Each output is one multiply-and-add over a 2 x 3 window, and the result is the green feature map.
= 3. Find the maxima =
We circle the largest value in each 1 x 2 window. Circling first is worth the extra step: it is the pooling decision, made before anything is written down.
= 4. Max pool 1 =
Let us copy those maxima down. Sixteen columns become eight, and half the detail is gone for good.
= 5. Convolution 2 =
We convolve again with the second kernel, deeper into the contracting path. The feature map is blue now.
= 6. Find the maxima again =
Same move as step 3, on the blue map.
= 7. Max pool 2 =
Eight columns become four.
= 8. The bottleneck =
Let us convolve once more. This is the bottom of the U, a 2 x 4 block that is everything the network kept.
= 9. Spread it out =
We start back up. The transposed convolution writes each bottleneck value into a wider grid, leaving gaps between them.
= 10. Transposed convolution 1 =
Let us fill those gaps by convolving over the spread-out grid. Four columns become eight.
= 11. The first skip =
We copy the encoder's matching row straight across. This is the skip connection, and it is the whole reason a U-Net can recover detail that pooling threw away.
= 12. Convolution with the skip =
Let us convolve the upsampled features together with the copied ones.
= 13. Spread it out again =
Same as step 9, one level up.
= 14. Transposed convolution 2 =
Eight columns become sixteen, back to the width we started at.
= 15. The second skip =
The encoder's first feature map comes across, the one made before any pooling happened.
= 16. Convolution and ReLU =
We convolve, then cross out every negative and set it to zero.
= 17. Output convolution =
Let us apply the last kernel. Out comes R', G' and B', an image the same size as the one we started with.
The outputs:
R' = [3, 0, 7, 0, 7, 0, 17, 0, 3, 0, 9, 0, 2, 0, 6, 0]
G' = [1, 20, 1, 10, 1, 12, 1, 19, 2, 5, 1, 11, 1, 3, 1, 7]
B' = [4, 20, 8, 10, 8, 12, 18, 19, 5, 5, 10, 11, 3, 3, 7, 7]
Congrats! You just calculated a U-Net by hand.
💾 Save this post!
Great technical paper from Google.
Great read on why context beats scale for agents working against unfamiliar APIs.
(bookmark it)
GPU kernel optimization has KernelBench to hillclimb on. TPUs had nothing, and the Pallas DSL is documented thinly enough that models mostly guess. New research from Google, Harvard, and UC Berkeley introduces JAXBench, 50 JAX workloads built from real MaxText architectures like Llama-3.1, DeepSeek-V3, Mixtral, Mamba-2, and AlphaFold2.
Eight operators ship with hand-tuned Pallas kernels from Tokamax, so agent output gets measured against expert work instead of a naive baseline.
With Gemini 3 Flash, conditioning on curated TPU documentation lifts per-sample correctness from 5.8% to 37.3%, solving 48 of 50 benchmarks at a 1.28x geomean speedup. Beam search then pushes it to 1.36x.
Correctness turned out to be a documentation problem and speed turned out to be a search problem.
Paper: https://t.co/8lOLtFHlfq
Learn to build effective AI agents in our academy: https://t.co/1e8RZKs4uX
Linuxカーネルの名著『Understanding the Linux Kernel』の英語版PDFが無料で公開されていることを知りました。🐧
英語を勉強していて良かったと思える瞬間ですね。
少しずつ読み進めながら、学んだことをアウトプットしていきたいと思います💪
https://t.co/W5NNwlVX62
#Linux#LinuxKernel #エンジニア #英語学習
量子コンピュータが25倍高速化!
IBM Quantumは、新プロセッサ「Nighthawk r2」で量子ビットの高速リセット技術を実現し、回路処理性能を従来比25倍に向上させました。 誤り訂正に不可欠な初期化精度も11倍改善し、実用的な誤り耐性量子コンピュータへの前進となる成果です。https://t.co/3zHdnO0afi