Take it slow, compute gradients
Project description
slowgrad
A small neural network library optimized for learning.
Inspired by PyTorch, micrograd, and tinygrad.
Build an MNIST Convnet
from slowgrad.layers import Linear, Conv2d
class TinyConvNetLayer:
def __init__(self):
self.c1 = Conv2d(1,8,kernel_size=(3,3))
self.c2 = Conv2d(8,16,kernel_size=(3,3))
self.l1 = Linear(16*5*5,10)
def parameters(self):
return [*self.l1.get_parameters(), *self.c1.get_parameters(), *self.c2.get_parameters()]
def forward(self, x):
x = x.reshape(shape=(-1, 1, 28, 28))
x = self.c1(x).relu().max_pool2d()
x = self.c2(x).relu().max_pool2d()
x = x.reshape(shape=[x.shape[0], -1])
return self.l1(x).logsoftmax()
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
slowgrad-0.1.1.tar.gz
(6.1 kB
view details)
Built Distribution
File details
Details for the file slowgrad-0.1.1.tar.gz
.
File metadata
- Download URL: slowgrad-0.1.1.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe4db1b600889c4ae966adb87c331cf5de462a53256ec96a92ce5f599f32944c |
|
MD5 | 492c596a7de6c3a748e67988e8394836 |
|
BLAKE2b-256 | 1c11619680d629984b06068266f22831f89e1f604b1d334d37b755f872d07dad |
File details
Details for the file slowgrad-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: slowgrad-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64e4902030ce703aae3284b103cc1e63de84203b270b7f7f7630578b51a51933 |
|
MD5 | b5c2a76f23ad7e5e4692afdd3b64b19c |
|
BLAKE2b-256 | d8645380a03f1b8b1fd18eeaa195f33798a7080e157cffe77282543c1e0002d0 |