# duoan/torchcode

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/duoan-torchcode).**

_How this analysis was created: the description and tags below were written by an AI model that read this project's README and public documentation pages; stars, license and language come straight from the GitHub API. The model does not read the source code._

4,734 stars · 426 forks · Jupyter Notebook

## Links

- GitHub: https://github.com/duoan/TorchCode
- Homepage: https://huggingface.co/spaces/duoan/TorchCode
- awesome-repositories: https://awesome-repositories.com/repository/duoan-torchcode.md

## Topics

`interview` `leetcode` `pytorch`

## Description

TorchCode is a PyTorch practice platform made up of Jupyter notebooks, where learners implement operators and model components from scratch and get instant automated grading. Each problem is a self-contained notebook with a blank template to fill in. A built-in judge imports the submitted function and runs it against several test cases. It checks numerical correctness, gradient flow through autograd, and edge cases, then reports a pass or fail for each test.

Every problem comes with a hint layer and a full reference solution, so a stuck learner can get a nudge first and study the complete answer afterward. Progress is saved locally: solved problems, best times, and attempt counts, with no account or database. Any notebook can be reset to its blank template for a fresh attempt. New problems are picked up automatically when a task file is placed in the tasks folder. Besides the notebooks, a standalone web IDE with a code editor and dual-pane layout talks to a separate API server that runs the same judge.

The problem set mirrors skills tested in machine learning interviews. It covers core operators such as softmax, normalization layers, and convolutions, and attention variants from scaled dot-product to grouped-query and sliding-window. It also covers transformer components such as language-model blocks, expert-routing layers, low-rank adapters, and vision patch embeddings. Training topics include optimizers, learning-rate schedules, gradient clipping, and alignment losses, and inference topics include top-k and top-p sampling, beam search, and speculative decoding. A weekly study plan with time estimates organizes the material from foundations through attention, architectures, and inference.

You can try problems online through hosted notebooks or Google Colab, or run the whole environment on your own machine in a single container with one command. No signup, database, or GPU is required.

## Tags

### Education & Learning Resources

- [PyTorch Code Exercises](https://awesome-repositories.com/f/education-learning-resources/deep-learning-education/deep-learning-platforms/pytorch-deep-learning-examples/pytorch-code-exercises.md) — Provides a curated set of PyTorch exercises for implementing softmax, normalization, attention, and Transformer components from scratch in notebooks.
- [Embedded Notebook Exercises](https://awesome-repositories.com/f/education-learning-resources/coding-exercises/embedded-notebook-exercises.md) — Delivers each problem as a self-contained notebook with a blank template that learners fill in and run in the same document.
- [Coding Interview Preparation](https://awesome-repositories.com/f/education-learning-resources/coding-interview-preparation.md) — Offers hands-on PyTorch coding problems mirroring machine learning interview questions, with a weekly study plan and instant feedback.
- [Jupyter Notebook Curricula](https://awesome-repositories.com/f/education-learning-resources/jupyter-notebook-curricula.md) — Delivers each problem as a self-contained Jupyter notebook with a blank template, hints, and a reference solution.
- [Multiple Choice Grading](https://awesome-repositories.com/f/education-learning-resources/multiple-choice-grading.md) — Runs submitted functions against multiple test cases and reports a colored pass or fail for each test. ([source](https://github.com/duoan/torchcode#readme))
- [Practice Problem Sets](https://awesome-repositories.com/f/education-learning-resources/practice-problem-sets.md) — Provides a broad set of notebook practice problems where learners implement operators, attention, and language models from scratch. ([source](https://github.com/duoan/torchcode#readme))
- [Exercise-Solution Pairings](https://awesome-repositories.com/f/education-learning-resources/curricula-instructional-design/instructional-design/exercise-solution-pairings.md) — Pairs every problem with a hint layer and a full reference solution notebook to study after attempting it.
- [Instant Answer Feedback](https://awesome-repositories.com/f/education-learning-resources/instant-answer-feedback.md) — Returns immediate pass or fail results after a learner submits an implementation against automated tests. ([source](https://github.com/duoan/torchcode#readme))
- [LeetCode Solution References](https://awesome-repositories.com/f/education-learning-resources/leetcode-solution-references.md) — Offers gentle hints first and a complete reference solution afterward for every practice problem. ([source](https://github.com/duoan/torchcode#readme))
- [Notebook Practice Environments](https://awesome-repositories.com/f/education-learning-resources/online-course-delivery-platforms/self-hosted-platforms/notebook-practice-environments.md) — Runs the full notebook practice environment in a single container with one command, needing no signup, database, or GPU.
- [Practice Progress Tracking](https://awesome-repositories.com/f/education-learning-resources/practice-progress-tracking.md) — Records solved problems, best completion times, and attempt counts locally so learners can measure improvement across sessions. ([source](https://github.com/duoan/torchcode#readme))
- [Implementation Practice](https://awesome-repositories.com/f/education-learning-resources/problem-solving-guides/interview-problem-solving/implementation-practice.md) — Offers curated problems where learners implement softmax, normalization layers, and convolutions from scratch in notebooks, mirroring skills tested in interviews. ([source](https://github.com/duoan/torchcode#readme))
- [Interview Study Paths](https://awesome-repositories.com/f/education-learning-resources/problem-solving-guides/interview-study-paths.md) — Lays out a weekly study plan with time estimates from foundations through attention, architectures and inference to prepare for interviews. ([source](https://github.com/duoan/torchcode#readme))

### Artificial Intelligence & ML

- [Neural Network Operator Implementations](https://awesome-repositories.com/f/artificial-intelligence-ml/neural-network-operator-implementations.md) — Has learners write softmax, normalization, and convolution operators from first principles and checks their numerical behavior and gradient flow.
- [From-Scratch Decoder Implementations](https://awesome-repositories.com/f/artificial-intelligence-ml/decoder-architectures/from-scratch-decoder-implementations.md) — Has learners build attention, GPT-2 style blocks, and mixture-of-experts layers by hand instead of calling library code.
- [Decoding Sampling Strategies](https://awesome-repositories.com/f/artificial-intelligence-ml/decoding-sampling-strategies.md) — Covers top-k and top-p sampling, beam search and speculative decoding exercises so learners see how text generation works internally. ([source](https://github.com/duoan/torchcode#readme))
- [Gradient Verification Tools](https://awesome-repositories.com/f/artificial-intelligence-ml/gradient-computation/gradient-verification-tools.md) — Verifies submitted implementations by backpropagating through them and comparing the resulting gradients, catching code that looks correct but breaks training.
- [Language Model Training and Decoding Techniques](https://awesome-repositories.com/f/artificial-intelligence-ml/language-model-training-and-decoding-techniques.md) — Includes exercises on optimizers, learning-rate schedules, alignment losses, beam search, and top-k and top-p sampling.
- [Transformer Component Exercises](https://awesome-repositories.com/f/artificial-intelligence-ml/model-architecture-assemblers/transformer-component-exercises.md) — Challenges learners to build language-model blocks, expert-routing layers, low-rank adapters and vision patch embeddings from primitive operations. ([source](https://github.com/duoan/torchcode#readme))
- [Multi-Head Attention Mechanisms](https://awesome-repositories.com/f/artificial-intelligence-ml/multi-head-attention-mechanisms.md) — Guides learners to implement scaled dot-product, multi-head, causal, grouped-query and sliding-window attention variants from scratch. ([source](https://github.com/duoan/torchcode#readme))
- [Training Algorithm Exercises](https://awesome-repositories.com/f/artificial-intelligence-ml/training-algorithm-exercises.md) — Provides exercises for writing optimizers, learning-rate schedules, gradient clipping, gradient accumulation and alignment losses without built-in library versions. ([source](https://github.com/duoan/torchcode#readme))

### Part of an Awesome List

- [Practice Platforms](https://awesome-repositories.com/f/awesome-lists/learning/practice-platforms.md) — Offers a self-hostable Jupyter-based practice platform where learners implement PyTorch operators and architectures and get instant automated grading.

### Development Tools & Productivity

- [Automated Grading Workflows](https://awesome-repositories.com/f/development-tools-productivity/automated-code-submissions/automated-grading-workflows.md) — Imports a learner's submitted function and runs it against several test cases for numerical correctness, gradient flow and edge cases, then records pass or fail.

### Testing & Quality Assurance

- [Grading Systems](https://awesome-repositories.com/f/testing-quality-assurance/code-quality-review/automated-code-review/grading-systems.md) — Runs submitted functions against multiple test cases checking correctness, gradients, and edge cases, then reports pass or fail without a human reviewer.
- [Output Comparison Judges](https://awesome-repositories.com/f/testing-quality-assurance/software-testing/testing-frameworks/test-frameworks/assertions-and-validation/test-case-definitions/parametrized-test-cases/output-comparison-judges.md) — Ships a judge that imports submitted functions and runs them against predefined test cases, checking numerical results and autograd gradients.

### DevOps & Infrastructure

- [Self-Contained Judge Deployments](https://awesome-repositories.com/f/devops-infrastructure/container-orchestration/container-runtimes/runtime-configuration-interfaces/docker-socket-orchestrators/docker-target-configurators/docker-container-deployments/self-contained-judge-deployments.md) — Packages the notebook server and judge into one container image that starts with a single command.
