duoan

duoan / TorchCode

Public

🔥 LeetCode for PyTorch — practice implementing softmax, attention, GPT-2 and more from scratch with instant auto-grading. Jupyter-based, self-hosted or try online.

77
1
100% credibility
Found Mar 04, 2026 at 78 stars -- GitGems finds repos before they trend. Get early access to the next one.
Sign Up Free
AI Analysis
Jupyter Notebook
AI Summary

TorchCode is a self-hosted interactive coding practice environment for implementing core PyTorch machine learning operations like attention mechanisms and normalizations from scratch, featuring automated testing, hints, progress tracking, and reference solutions.

How It Works

1
🔍 Discover TorchCode

You hear about this fun practice tool for getting ready for machine learning job interviews by building key building blocks from scratch.

2
Pick Your Starting Way
🌐
Try Online Instantly

Click a link to open everything in your web browser—no setup needed.

💻
Set Up on Your Computer

Follow a quick guide to run it locally for unlimited private practice.

3
📖 Open the Practice Notebooks

A friendly workspace loads with blank pages for challenges and example answers.

4
✍️ Build and Test Your Solution

Pick a challenge like attention or normalization, write your code step by step, and hit test to see colorful pass or fail results instantly.

5
📊 Track Your Progress

Watch your dashboard update with solved challenges, best times, and what's next.

6
💡 Get Help When Stuck

Peek at gentle hints or full examples to learn tricks without spoiling the fun.

🎉 Master the Skills

You've practiced all the top interview problems, built confidence, and are ready to shine in your next ML job interview!

Sign up to see the full architecture

5 more

Sign Up Free

Star Growth

See how this repo grew from 78 to 77 stars Sign Up Free
Repurpose This Repo

Repurpose is a Pro feature

Generate ready-to-use prompts for X threads, LinkedIn posts, blog posts, YouTube scripts, and more -- with full repo context baked in.

Unlock Repurpose
AI-Generated Review

What is TorchCode?

TorchCode is LeetCode but for PyTorch: a set of Jupyter notebooks where you implement core ops like softmax, LayerNorm, multi-head attention, and full GPT-2 blocks from scratch, with instant auto-grading on correctness, gradients, and shapes. It runs self-hosted via Docker or Makefile (`make run`), or online via Hugging Face Spaces—no GPU or signup needed. Python-based, it targets PyTorch interview skills with 13 curated problems and notebook APIs like `check("softmax")` for feedback.

Why is it gaining traction?

Unlike static LeetCode GitHub solutions or Python extensions, it delivers colored pass/fail per test case, hints without spoilers, progress dashboards, and reference solutions in one interactive environment. Developers hook on the whiteboard-style practice for top ML teams (Meta, OpenAI), plus easy resets for repeated drills. Self-contained Docker means zero setup friction, beating scattered LeetCode PyTorch questions on GitHub repos.

Who should use this?

ML engineers grinding interviews at FAANG or AI labs, needing to nail from-scratch implementations of attention mechanisms or norms. Transformer builders debugging custom layers. PyTorch devs skipping `torch.nn` for deeper understanding, like implementing causal or sliding-window attention.

Verdict

Solid pick for targeted PyTorch interview prep—docs are crisp, problems hit real pain points—but at 77 stars and 1.0% credibility, it's early-stage; expect occasional rough edges. Fork and contribute if you add problems.

(198 words)

Sign up to read the full AI review Sign Up Free

Similar repos coming soon.