Simple abstractions3.py fix (#5343)

* abstractions3.py fix

* Add abstractions3.py to CI tests
This commit is contained in:
Ian Paul 2024-07-09 10:48:42 +00:00 committed by GitHub
parent a2a9bfd2ec
commit d5a68ae6b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View File

@ -133,6 +133,7 @@ jobs:
- name: Test Docs
run: |
python docs/abstractions2.py
python docs/abstractions3.py
- name: Test Quickstart
run: awk '/```python/{flag=1;next}/```/{flag=0}flag' docs/quickstart.md > quickstart.py && PYTHONPATH=. python quickstart.py
- name: Test README

View File

@ -27,7 +27,7 @@ l1n, l2n = l1.numpy(), l2.numpy()
from tinygrad.nn.optim import SGD
optim = SGD([l1, l2])
X, Y = X_train[samples:=Tensor.randint(128, high=X_train.shape[0])], Y_train[samples]
X, Y = X_train[(samples:=Tensor.randint(128, high=X_train.shape[0]))], Y_train[samples]
optim.zero_grad()
model(X).sparse_categorical_crossentropy(Y).backward()
optim._step() # this will step the optimizer without running realize
@ -48,7 +48,7 @@ for si in schedule: print(str(si)[:80])
# 4. Lower a schedule.
from tinygrad.engine.realize import lower_schedule_item, ExecItem
lowered: List[ExecItem] = [ExecItem(lower_schedule_item(si), list(si.bufs)) for si in tqdm(schedule)]
lowered: List[ExecItem] = [ExecItem(lower_schedule_item(si).prg, list(si.bufs)) for si in tqdm(schedule)]
# *****
# 5. Run the schedule