A minimal PyTorch-like deep learning library
Project description
ASTen (A Small Tensor Library)
ASTen is a small, educational tensor library inspired by PyTorch. It is designed to help users understand the internal workings of the Pytorch framework by providing a simplified implementation of core components.
Inspiration
- After reading the Pytorch internals by ezyang, I was motivated to build a similar library. I wanted something simple but a reflection of Pytorch itself. I have been using AI to navigate through the pytorch codebase and also to debug my C/C++ code cause I am new to C and C++
Current Features
- Tensor: A multi-dimensional array object.
- View: Create a new tensor that is a view of an existing tensor.
- Reshape View that works on non-contiguous tensors.
Planned Features
- Mathematical operations
- Autograd engine
- CUDA Support
Project Structure
The project is organized into the following directories, mimicking a simplified PyTorch structure:
.
├── ASTen/
├── aten/
│ └── native/
├── c10/
│ └── core/
├── setup.py
└── README.md
Installation
You can install ASTen from the source:
pip install -e .
Usage
Here is a simple example of how to create a tensor and use the view operation:
import ASTen
import numpy as np
# Create a tensor from a numpy array
data = np.array([1, 2, 3, 4, 5, 6])
x = ASTen.tensor(data)
print(f"Original tensor shape: {x.shape}")
# Create a view of the tensor
y = x.view((2, 3))
print(f"Viewed tensor shape: {y.shape}")
Contributing
Contributions are welcome! Please feel free to submit a pull request or open an issue.
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file asten-0.1.0.tar.gz.
File metadata
- Download URL: asten-0.1.0.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4afbf17823959d97cedc1cb7aca8618946c8e5a7ff6f7a846afe09b02385741e
|
|
| MD5 |
86b670f216fecb5c42bba56ab2a51c48
|
|
| BLAKE2b-256 |
35442942265befe24cade94c2974fe632603313f1bfdf745f699b3bfa3ff8122
|