logoalt Hacker News

Torch.ts – building PyTorch in TypeScript from scratch to learn

41 pointsby 13point5last Wednesday at 8:49 AM10 commentsview on HN

Comments

fleshmonadyesterday at 2:56 AM

Are these posts just made to have a better chance of being hired?

show 1 reply
tfshyesterday at 5:31 AM

I think I must have just spent more time (5 mins) looking at this repo trying to understand why you posted it, than you spent actually coding this.

I don't want to put you off, but there's no substance at all here, I'd have assumed Claude wrote it based on the fact you've vendored in rules, but the code is so questionable, even an LLM from 2022 would do better. E.g. 'flattenData' from utils could just be [1] rather than a BFS, though I don't really get why your public API allows TensorData to be a single integer in the first place, 50% of your logic is to work around that.

But rant over. My point is, maybe post this when you've built even 5% of PyTorch, or learnt something of value, or have something tangible to impart upon us, rather than a library of ill-thought-out array utils.

1: flattenData = (x: TensorData) => Array.isArray(x) ? x.flat(Infinity) : [x]

show 1 reply
wesammikhailyesterday at 3:45 AM

The entire repo is 2-3 array access functions. Why is it even posted here? No harm in trying to learn but there is nothing in here that is even close to PyTorch.

show 2 replies
13point5last Wednesday at 8:49 AM

Right now it's just a tensor manipulation lib but will be adding an autograd engine soon. It's been fun learning about strides and doing matmuls by hand and then coding it without numpy.

show 1 reply