
Can Python code run without Python?
Image: Pratik89Roy, CC BY-SA 4.0, via Wikimedia Commons
Can Python code run without Python?
Imagine you've written a Python script to calculate your monthly expenses. You want to use it on your friend's computer, which doesn't have Python installed.
You can transform your Python script into TorchScript, a format that lets you run Python code on different platforms without needing Python itself.
Example
Your Python function `calculate_expenses(income, expenses)` is converted into TorchScript, allowing it to run on your friend's computer.
Remember this
TorchScript acts as a bridge, enabling Python code to run outside the Python environment.
Text adapted from Wikipedia, licensed under CC BY-SA 4.0.
torch.compile does in PyTorch 2.0: traces and optimizes the computation graph
Ever wondered how computers speed up learning?
Tracing
Tracing records operations, scripting parses Python
a Triton @triton.jit decorator does: compiles a Python function into a GPU kernel
@triton.jit decorator compiles Python function into a GPU kernel
Arm architecture family
ARM processors are the most widely used family of instruction set architectures
Viterbi semiring
How do we find the best path in a maze of choices?
continuation-passing style (CPS) does: makes control flow explicit via callbacks
Why can't we just call functions directly and let them handle everything?
Swipe through 100 ML concepts daily
Open Pocket Polymath