thomasahle/tensorgrad
Machine Learning with Symbolic Tensors
▲ 1 hacker recommends Python ★ 372 AGPL-3.0 autogradderivativesneurosymbolicprobabilitysymbolic-computationtensor
Recommended between 2025-11-02 and 2025-11-02. Last pushed 2026-10-13.
▲ 1 recommend · ▼ 0 criticisms
What hackers say
“There's also https://github.com/thomasahle/tensorgrad which uses sympy for "axis" dimension variables”
— thomasahle, 2025-11-02 · original comment on Hacker News ↗
show original comment
You can do that in python using https://github.com/patrick-kidger/torchtyping looks like this: def batch_outer_product(x: TensorType["batch", "x_channels"], y: TensorType["batch", "y_channels"] ) -> TensorType["batch", "x_channels", "y_channels"]: return x.unsqueeze(-1) * y.unsqueeze(-2) There's also https://github.com/thomasahle/tensorgrad which uses sympy for "axis" dimension variables: b, x, y = sp.symbols("b x y") X = tg.Variable("X", b, x) Y = tg.Variable("Y", b, y) W = tg.Variable("W", x, y) XWmY = X @ W - Y
Badge for your README
[](https://hackerrepos.org/repo/thomasahle/tensorgrad)