TorchLeet is a curated set of PyTorch practice problems, inspired by LeetCode-style challenges, designed to enhance your skills in deep learning and PyTorch.
- Implement linear regression(Solution)
- Write a custom Dataset and Dataloader to load from a CSV file(Solution)
- Write a custom activation function (Simple)(Solution)
- Implement Custom Loss Function (Huber Loss)(Solution)
- Implement a Deep Neural Network(Solution)
- Visualize Training Progress with TensorBoard in PyTorch(Solution)
- Save and Load Your PyTorch Model(Solution)
- Implement an LSTM(Solution)
- Implement a CNN on CIFAR-10(Solution)
- Implement parameter initialization for a CNN(Solution)
- Implement an RNN(Solution)
- Use
torchvision.transformsto apply data augmentation(Solution) - Add a benchmark to your PyTorch code(Solution)
- Train an autoencoder for anomaly detection(Solution)
- Write a custom Autograd function for activation (SILU)(Solution)
- Write a Neural Style Transfer
- Write a Transformer(Solution)
- Write a GAN(Solution)
- Write Sequence-to-Sequence with Attention(Solution)
- Quantize your language model(Solution)
- [Enable distributed training in pytorch (DistributedDataParallel)]
- [Work with Sparse Tensors]
- Implement Mixed Precision Training using torch.cuda.amp(Solution)
- Add GradCam/SHAP to explain the model.(Solution)
What's cool? 🚀
- Diverse Questions: Covers beginner to advanced PyTorch concepts (e.g., tensors, autograd, CNNs, GANs, and more).
- Guided Learning: Includes incomplete code blocks (
...and#TODO) for hands-on practice along with Answers
- Install pytorch: Install pytorch locally
- Some problems need other packages. Install as needed.
<E/M/H><ID>/: Easy/Medium/Hard along with the question ID.<E/M/H><ID>/qname.ipynb: The question file with incomplete code blocks.<E/M/H><ID>/qname_SOLN.ipynb: The corresponding solution file.
- Navigate to questions/ and pick a problem
- Fill in the missing code blocks
(...)and address the#TODOcomments. - Test your solution and compare it with the corresponding file in
solutions/.
Happy Learning! 🚀
Feel free to contribute by adding new questions or improving existing ones. Ensure that new problems are well-documented and follow the project structure.
Chandrahas Aroori 💻 AI/ML Dev | Caslow Chien 💻 Developer |
