# 从CUDA到TorchTPU：Cayley图求解实战

Original title: From CUDA and Jax to TorchTPU: Lessons from a Cayley Graph Solver

> Hacker News story 50633424 · language: zh · submitted 2026-11-24
> Web version: https://zeli.app/zh/story/50633424
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 77 · by [Artgor](<https://news.ycombinator.com/user?id=Artgor>) · 💬 1
[original](<https://andlukyane.com/blog/cayley-graphs-and-torchtpu>) · [HN discussion](<https://news.ycombinator.com/item?id=50633424>)

## Summary

我曾将基于CUDA和JAX的Cayley图求解器迁移到Google新开源的TorchTPU。起初，TorchTPU版本比A100慢1.65倍，Beam Search更是慢了5.7倍。通过优化Eager执行、重写Attention机制、消除动态张量形状并修复Deduplication Bug，我不仅追平了A100的训练速度，更让优化后的TorchTPU在Beam Search上比JAX快了25%。这次迁移让我深刻体会到，让TorchTPU跑起来很简单，但要跑得快却需要深入理解其底层机制。

## Key quote

> 让 TorchTPU 跑起来很容易，但要让它高效运行却难得多。

---

## Cite

- Page: https://zeli.app/zh/story/50633424
- Date: 2026-11-24
- Source: andlukyane.com (https://andlukyane.com/blog/cayley-graphs-and-torchtpu)
- Hacker News: https://news.ycombinator.com/item?id=50633424

## Other languages

- en: https://zeli.app/story/50633424 · markdown: https://zeli.app/story/50633424.md
- ja: https://zeli.app/ja/story/50633424 · markdown: https://zeli.app/ja/story/50633424.md
- ko: https://zeli.app/ko/story/50633424 · markdown: https://zeli.app/ko/story/50633424.md
- de: https://zeli.app/de/story/50633424 · markdown: https://zeli.app/de/story/50633424.md
- es: https://zeli.app/es/story/50633424 · markdown: https://zeli.app/es/story/50633424.md
- ru: https://zeli.app/ru/story/50633424 · markdown: https://zeli.app/ru/story/50633424.md
