srush / Tensor-Puzzles

Solve puzzles. Improve your pytorch.
MIT License
3.19k stars 269 forks source link

Plans for more puzzles? #16

Open kaiavintr opened 1 year ago

kaiavintr commented 1 year ago

I nominate amin (or amax), nonzero, and, sort.

srush commented 1 year ago

I'm always happy for a PR if you are interested.

I think these ones are quite difficult to do though. Would be curious how you pull it off. Nonzero is a particularly nasty one because it has dynamic output size (but maybe you could do it with padding)

Maybe check out autodiff-puzzles for some sorting fun.

kaiavintr commented 1 year ago

I don't want to give spoilers, but nonzero was easy once I realized the trick (and it's an important trick, so I think it would make a good addition). Sort was definitely challenging, and took many tries to get it under 80 characters though.

I am definitely going to check out your other puzzles! Thank you so much for making these!

dantp-ai commented 7 months ago

torch.gather would be a nice addition to this awesome collection of puzzles.