test backward in test_tiny (#11697)

* test backward in test_tiny

* empty
This commit is contained in:
George Hotz
2025-08-16 20:29:39 -07:00
committed by GitHub
parent 4666df71c1
commit 9366a23eb0
3 changed files with 20 additions and 3 deletions

View File

@@ -29,8 +29,7 @@ if __name__ == "__main__":
opt.zero_grad()
samples = Tensor.randint(getenv("BS", 512), high=X_train.shape[0])
loss = model(X_train[samples]).sparse_categorical_crossentropy(Y_train[samples]).backward()
opt.step()
return loss
return loss.realize(*opt.schedule_step())
@TinyJit
def get_test_acc() -> Tensor: return (model(X_test).argmax(axis=1) == Y_test).mean()*100