stared/thinking-in-tensors-writing-in-pytorch
View on GitHub ↗ ★ 397 Jupyter Notebook
Thinking in tensors, writing in PyTorch (a hands-on deep learning intro)
17 mentions on Hacker News by 1 person: 0 stories, 17 comments · first 2019-05-29 · latest 2025-12-16
20082026
-
On the contrary, I think that well-designed general-purpose languages beat domain-specific languages. Even in the example given, in NumPy you can use np.array, but to make a fair comparison, use np.matrix. import numpy as np X =…
comment by stared · 2025-12-16 · in In Defense of Matlab Code -
In 2018, I co-wrote a blog post with the inflammatory title “Don’t use TensorFlow, try PyTorch instead” ( https://news.ycombinator.com/item?id=17415321 ). As it gained traction here, it was changed to “Keras vs PyTorch” (some edgy things…
comment by stared · 2025-11-07 · in Leaving Meta and PyTorch -
Nice to see it! I think that a lot of mathematics would benefit from executable code (or I would say - executable maths) - so people can play and experiment with it. I had my own approach for teaching deep learning (…
comment by stared · 2025-09-26 · in Show HN: A little notebook for learning linear algebra with Python -
Well, in short - basic linear algebra, basic probability, analysis (functions like exp), gradient. At some point I tried to create an introduction step-by-step, where people can interact with these concepts and see how to express it in…
comment by stared · 2025-09-06 · in The maths you need to start understanding LLMs -
I really recommend this explorable explanation: https://setosa.io/ev/ordinary-least-squares-regression/ And for actual gradient descent code, here is an older example of mine in PyTorch: https://github.com/stared/thinking-in-tensors-writing…
comment by stared · 2025-05-08 · in How linear regression works intuitively and how it leads to gradient descent -
A few nitpicks: First, I am not sure whom you refer to - as (I hope) everyone who uses cosine similarity has seen a . b = |a||b| cos theta. I read its very name, "cosine (of the angle between vectors) used as a similarity measure". Second,…
comment by stared · 2025-01-15 · in Don't use cosine similarity carelessly -
Well, MNIST is a trivial dataset. Many simple methods work astonishingly well. For example, it takes some tuning to beat k Nearest Neighbors with a neural network. Or it is enough to use t-SNE to cluster digits in an unsupervised way…
comment by stared · 2022-12-22 · in Scaling Down Deep Learning -
To some extent, it is a matter of taste. Personally, I love functional notation (technically, in PyTorch its chaining) e.g.: x.matmul(y).pow(2).sum() This way we can rite a lot of things, and we don't need to make up a new combination of…
comment by stared · 2020-06-13 · in Math-as-Code (2015) -
Shameless plug, but I worked for some time on "Thinking in Tensors, Writing in PyTorch" pretty much focusing on turning LaTeX math into executable code. E.g. Gradient Descent: formula, code, and visualization:…
comment by stared · 2020-03-20 · in Math Symbols Explained with Python -
“Scientists start out doing work that's perfect, in the sense that they're just trying to reproduce work someone else has already done for them. Eventually, they get to the point where they can do original work. Whereas hackers, from the…
comment by stared · 2020-01-01 · in Ask HN: Full-on machine learning for 2020, what are the best resources? -
I have some projects based on Jupyter Notebook (e.g. https://github.com/stared/thinking-in-tensors-writing-in-pyt... ), and collaboration sucks. Even with git, I need to resort to "don't touch these files, I am working on them right now".…
comment by stared · 2019-11-29 · in Making Git and Jupyter Notebooks play nice -
I tried to do from scratch AND hands-on in PyTorch: https://colab.research.google.com/github/stared/thinking-in-... By all means, much more "from scratch". It is a part of open-source "Thinking in Tensors, Writing in PyTorch":…
comment by stared · 2019-10-19 · in ML From Scratch, Part 1: Linear Regression -
I wrote a piece on that in: https://github.com/stared/thinking-in-tensors-writing-in-pyt... > If I wanted to learn some particular framework, I would just look up the documentation for that framework. Well, if you don't know deep learning,…
comment by stared · 2019-08-12 · in Ask HN: What Neural Networks/Deep Learning Books Should I Read? -
In that line, I started "Thinking in tensors, writing in PyTorch" https://github.com/stared/thinking-in-tensors-writing-in-pyt... .
comment by stared · 2019-07-18 · in Think in Math, Write in Code -
Some context on image classifier trained on ImageNet dataset here: https://github.com/stared/thinking-in-tensors-writing-in-pyt... (a Jupyter/Colab notebook, so you can use various networks, including AlexNet). Such hallucinations are…
comment by stared · 2019-07-07 · in AlexNet hallucination quiz: can you find which image matches the stated class? -
Source: https://github.com/stared/thinking-in-tensors-writing-in-pyt... (from "Thinking in Tensors, Writing in PyTorch": https://github.com/stared/thinking-in-tensors-writing-in-pyt... ) Looking for feedback.
comment by stared · 2019-06-30 · in Show HN: Using an ImageNet-pretrained image classification model in PyTorch -
I try to achieve this goal with "Thinking in Tensors, Writing in PyTorch" project: https://github.com/stared/thinking-in-tensors-writing-in-pyt... (very much a Work in Progress). The idea is to have equations (in LaTeX) and code (in…
comment by stared · 2019-05-29 · in Translating math into code with examples in Java, Racket, Haskell, Python (2011)