Understand Deep Learning Frameworks by building one from scratch

A modern educational deep learning framework for students, engineers and researchers

Pure Python Implementation
Full functionality
PyTorch-compatible API
Step-by-step Learning Path

TensorWeaver is designed specifically for students, engineers and researchers who want to understand how deep learning frameworks work under the hood. Unlike industrial frameworks like PyTorch and TensorFlow that prioritize performance and scalability, TensorWeaver focuses on clarity, readability, and simplicity.

Built entirely in Python with only NumPy as a dependency, TensorWeaver's codebase is transparent and approachable, making it an ideal learning resource for those who want to demystify the "magic" behind modern AI frameworks.

Why TensorWeaver?

Built for learning, understanding, and demystifying the "magic" behind modern deep learning frameworks

📚

Educational Focus

Clear, readable code with comprehensive documentation designed for students, engineers and researchers.

  • Detailed explanations
  • Step-by-step tutorials
  • Interactive examples
🐍

Pure Python & NumPy

Built with familiar tools to ensure easy understanding and modification.

  • No complex dependencies
  • Easy to debug
  • Transparent, approachable codebase
🎯

PyTorch-like API

Familiar interface that makes transitioning to industrial frameworks seamless.

  • Dynamic computation graphs
  • Intuitive design patterns
  • Industry-standard workflow
🚀

Advanced Features

Essential capabilities for real-world deep learning applications.

  • ONNX export support
  • Skills to debug and extend
  • GPU acceleration (coming soon)

Getting Started

Start using TensorWeaver in minutes

Installation

Install TensorWeaver easily using pip:

pip install tensorweaver

That's it! TensorWeaver only requires NumPy as a dependency.

Source Code

Access the full source code on GitHub:

View on GitHub

Explore the implementation, contribute, or simply learn from browsing the code.

Check out our comprehensive documentation for tutorials and examples.

Learn by Implementation

Understand deep learning frameworks by implementing core components from scratch

Custom Addition Operator Try it yourself →

import tensorweaver as tw
import numpy as np

# Define a custom addition operator - it's that simple!
class CustomAdd(tw.Function):
    def forward(self, x, y):
        return x + y
    
    def backward(self, grad_output):
        # Gradient of addition flows to both inputs
        return grad_output, grad_output

# Try it out!
x = tw.Tensor([1.0, 2.0])
y = tw.Tensor([0.1, 0.2])
z = CustomAdd()(x, y)

print("Result:", z.data)  # [1.1, 2.2]

Start with simple operators and gradually explore more complex implementations. Our step-by-step guides help you understand every concept clearly.

About the Author

Xiaoquan Kong

Xiaoquan Kong

As the creator of TensorWeaver, I'm passionate about making deep learning more accessible and understandable. With 10+ years work experience in Machine Learning Field, I've designed and implemented AI systems used by millions of users.

I'm a Google Developer Expert (GDE) in Machine Learning, an open-source contributor to major ML frameworks, and the author of technical books on machine learning. I'm currently pursuing a Master's degree in AI for Product Innovation at Duke University.

Through TensorWeaver, I aim to bridge the gap between theoretical concepts and practical implementation, helping students, engineers and researchers understand the inner workings of deep learning frameworks. My goal is to demystify AI and empower others to innovate in this rapidly evolving field.

Get in Touch

Have questions, suggestions, or want to contribute to TensorWeaver? I'd love to hear from you!