The TorchTPU Book is a free online book for PyTorch engineers who move real models from CUDA to Cloud TPU and need to know when the numbers they get are correct and real.
TorchTPU is an open-source, native PyTorch backend for Google Cloud TPUs, built by Google together with the PyTorch team at Meta.
The problem: it runs, and that is all you know
You change torch.device("cuda") to torch.device("tpu") and backend="nccl" to backend="tpu_dist" . The model runs. The TorchTPU authors are explicit about what that does not give you: peak TPU performance, because your shapes, sharding and operators may be tuned for a GPU.
Notice the two arrows into TorchTPU, one for each string you changed: operations on the "tpu" device reach it through the dispatcher, and "tpu_dist" collectives through the ProcessGroup API.…