Hacker GitHub

← All repos

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

Mentions per year 17 mentions · busiest year 2019 (7)
20082026
  1. 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
  2. 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
  3. 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 (…
  4. 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…
  5. 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…
  6. 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
  7. 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
  8. 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)
  9. 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
  10. “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…
  11. 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".…
  12. 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":…
  13. 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,…
  14. 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
  15. 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…
  16. 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.
  17. 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…