refactor into utils

This commit is contained in:
George Hotz
2020-10-18 14:36:29 -07:00
parent 0c3dd12b3b
commit cc9054e3ec
3 changed files with 12 additions and 8 deletions

View File

@@ -42,11 +42,12 @@ print(y.grad) # dz/dy
```python
from tinygrad.tensor import Tensor
import tinygrad.optim as optim
from tinygrad.utils import layer_init_uniform
class TinyBobNet:
def __init__(self):
self.l1 = Tensor(layer_init(784, 128))
self.l2 = Tensor(layer_init(128, 10))
self.l1 = Tensor(layer_init_uniform(784, 128))
self.l2 = Tensor(layer_init_uniform(128, 10))
def forward(self, x):
return x.dot(self.l1).relu().dot(self.l2).logsoftmax()